Fill Forms, Validate E-Invoices, and Read PDF Metadata

This guide shows developers how to use PDFluent to handle interactive forms, process e-invoices, and manage document metadata. It is for Rust programmers working with PDFs.

PDF forms that actually fill.

Fill and flatten AcroForm PDF forms. Passes the PDF 1.7 conformance test suite (Adobe test corpus, 304 tests). Import data from FDF, XFDF, or JSON.
rust
use pdfluent::PdfDocument;

fn main() -> pdfluent::Result<()> {
    let mut doc = PdfDocument::open("form.pdf")?;
    println!("{} form field(s)", doc.form_fields()?.len());

    doc.form_mut()
        .set_text("name", "Jane Smith")?
        .set_checkbox("subscribe", true)?;

    doc.save("filled.pdf")?;
    Ok(())
}
What's the difference between AcroForm and XFA?
AcroForm is the traditional PDF form format defined in PDF 1.7 and earlier. XFA (XML Forms Architecture) is an Adobe-proprietary format based on XML. PDFluent supports AcroForm natively in Rust; for XFA support, see the legacy forms solution.
Does PDFluent pass the Adobe conformance test suite?
Yes. PDFluent's AcroForm implementation passes the PDF 1.7 conformance test suite (Adobe test corpus, 304 tests). This includes complex scenarios like radio button groups, conditional calculations, and multi-page forms.
Can I batch-process thousands of forms?
Yes. PDFluent supports batch form filling from JSON or database records. Each form is processed independently, and a per-form status report is generated. Parallel processing is supported for high-throughput workflows.
What data formats are supported for import/export?
FDF (Forms Data Format), XFDF (XML Forms Data Format), and JSON are supported for both import and export. JSON is recommended for modern workflows due to its flexibility and ease of integration.

XFA forms work again. Without Adobe.

Migrate XFA-based PDF forms to modern standards with PDFluent. Flatten, convert, and extract data from XFA 3.3 forms without Adobe dependencies.
rust
// Planned 1.1 surface — see note above.
// 1.0-compatible variant: fill AcroForm fields + save.
use pdfluent::prelude::*;

fn main() -> Result<()> {
    let mut doc = PdfDocument::open("belastingaangifte_2024.pdf")?;

    {
        let mut form = doc.form_mut();
        form.set_text("bsn", "123456782")?
            .set_text("name", "Test User")?;
    }

    doc.save("belastingaangifte_2024_filled.pdf")?;
    Ok(())
}
Does PDFluent support all XFA versions?
PDFluent supports XFA 3.3, the latest version of the XFA specification. This covers all forms created with Adobe LiveCycle, AEM Forms, and most third-party XFA form generators.
Can FormCalc scripts be executed?
Yes. PDFluent's XFA engine includes a full FormCalc interpreter. Field calculations, cross-field validation rules, and conditional visibility expressions are all evaluated before flattening or data extraction.
Can I process XFA forms in the browser without uploading to a server?
Yes. The XFA engine compiles to WebAssembly. The WASM bundle (3.8 MB with Brotli for @pdfluent/sdk-wasm@1.0.0 [B07, 2026-09-16]) processes forms entirely client-side — no file upload required. This is particularly useful for GDPR-sensitive government or healthcare forms.
Will flattened XFA forms look identical to the original?
PDFluent preserves layout, fonts, images, and filled values during flattening. The output is a static PDF that opens in any PDF reader without Adobe or browser plugin dependencies.

Read and write PDF metadata.

Access XMP metadata, document information dictionary, and custom properties. Batch update metadata across thousands of files.
rust
use pdfluent::PdfDocument;

fn main() -> pdfluent::Result<()> {
    let mut doc = PdfDocument::open("input.pdf")?;

    // Read existing metadata
    let info = doc.metadata();
    println!("Title: {:?}", info.title);
    println!("Author: {:?}", info.author);

    // Write new metadata
    doc.metadata_mut()
        .set_title("Q1 2026 Financial Report")
        .set_author("Finance Team")
        .set_subject("Quarterly earnings")
        .set_keywords(&["earnings", "Q1", "2026"])
        .commit()?;

    doc.save("output.pdf")?;
    Ok(())
}
Which fields are in the document info dictionary?
Title, Author, Subject, Keywords, Creator, Producer, CreationDate, and ModDate. These correspond to the /Info dictionary in the PDF trailer. PDFluent exposes all eight fields for both reading and writing.
Does modifying metadata change the file size significantly?
No. Metadata edits use incremental save. The change appends a small cross-reference section and the updated /Info object to the end of the file. The rest of the file is untouched.
Can I remove metadata entirely?
Yes. Call doc.clear_doc_info() to remove all fields from the info dictionary. Call doc.clear_xmp() to remove the XMP stream from the catalog. Both steps are needed to fully strip metadata from a document.
How are dates formatted in PDF metadata?
PDF date strings follow the format D:YYYYMMDDHHmmSSOHH'mm. PDFluent parses this format into a chrono::DateTime and serializes DateTime values back to the correct PDF date string. You work with standard Rust date types.