Documentation

Everything you need
to build with PDFluent.

Guides, code examples, and API reference for PDF processing in Rust.

Quick examples

Common operations to get started

Initialise & extract text

Rust
use pdfluent::Sdk;

let sdk = Sdk::init_with_license("license.json")?;
let doc = sdk.open("invoice.pdf")?;

// Full document text (reading order preserved)
let text = doc.extract_text()?;
println!("{}", text);

// Or per-page with bounding boxes
for page in doc.pages() {
    for block in page.extract_text_blocks()? {
        println!("[p{} {:.0},{:.0}] {}", block.page, block.x, block.y, block.text);
    }
}

Flatten XFA form

Rust
use pdfluent::Sdk;

let sdk = Sdk::init_with_license("license.json")?;
let doc = sdk.open("tax_return.xdp")?;

// Optionally pre-fill with XML data
let xml = std::fs::read("data.xml")?;
doc.import_xfa_data(&xml)?;

let flat = doc.flatten_xfa()?;
flat.save("tax_return_flat.pdf")?;
println!("Flattened {} pages.", flat.page_count());

Convert & validate PDF/A

Rust
use pdfluent::{Sdk, PdfaLevel};

let sdk = Sdk::init_with_license("license.json")?;
let doc = sdk.open("legacy.pdf")?;

// Validate existing compliance
let report = doc.validate_pdfa(PdfaLevel::A2b)?;
for v in report.violations() {
    eprintln!("[ยง{}] {}", v.clause, v.message);
}

// Convert to PDF/A-2b
let archived = doc.convert_to_pdfa(PdfaLevel::A2b)?;
archived.save("archived.pdf")?;

Sign a document (PAdES)

Rust
use pdfluent::{Sdk, Signer, SignatureOptions};

let sdk = Sdk::init_with_license("license.json")?;
let doc = sdk.open("contract.pdf")?;

let signer = Signer::from_pkcs12("cert.p12", "password")?;
let signed = doc.sign(signer, SignatureOptions {
    page: 0,
    reason: "Approved".to_string(),
    timestamp_url: Some("http://timestamp.sectigo.com".into()),
    ..Default::default()
})?;
signed.save("signed.pdf")?;

How-to guides

85+ step-by-step guides covering every PDF operation in Rust โ€” merging, signing, OCR, PDF/A, XFA, and more.

Browse all guides โ†’

Error reference

Error codes with explanations, root causes, and fixes. Covers common issues in iText, PDFBox, IronPDF migrations too.

Browse errors โ†’

Trial licence

Email [email protected] to start a 30-day trial. Full SDK, no feature restrictions, licence file within one business day.

Start a trial โ†’