Generate and validate ZUGFeRD and Factur-X e-invoices with PDFluent. Full PDF/A-3 compliance for EU e-invoicing mandates.
use pdfluent::{Sdk, invoice::{InvoiceBuilder, ZugferdProfile, ValidationLevel}};
let sdk = Sdk::init_with_license("license.json")?;
// Build the invoice data structure
let invoice = InvoiceBuilder::new()
.profile(ZugferdProfile::En16931)
.seller("Acme GmbH", "DE123456789")
.buyer("BundesMinisterium", "DE987654321")
.invoice_number("2024-001234")
.issue_date("2024-03-15")
.line_item("Consulting services", 10.0, 150.00, "H") // 19% VAT
.build()?;
// Validate against EN 16931 — 344 business rules
let validation = invoice.validate(ValidationLevel::En16931)?;
if !validation.is_valid() {
for rule in validation.violations() {
eprintln!(" {} — {}", rule.id(), rule.message());
}
return Err("Invoice failed EN 16931 validation".into());
}
// Embed XML into PDF/A-3b hybrid (ZUGFeRD)
let pdf = sdk.open("invoice_template.pdf")?;
let hybrid = pdf.attach_zugferd_invoice(&invoice)?;
hybrid.save("invoice_2024-001234.pdf")?;Run cargo add [email protected] to get started.
Create hybrid PDF/A-3 invoices with embedded XML conforming to ZUGFeRD 2.1 profiles: MINIMUM, BASIC, EN 16931, and XRECHNUNG.
Generate and validate XRechnung 3.0 documents for German federal procurement. KoSIT-validated output, ready for PEPPOL submission.
Built-in semantic validation against the EU invoice standard. Get precise error locations — which XML element, which business rule, why it failed.
Output compatible with the Pan-European Public Procurement Online network. Compliant with OpenPeppol specifications for cross-border e-invoicing.
Validation runs entirely in-process. No internet connection, no third-party validation service, no data leaving your infrastructure.
Generate thousands of invoices per second. Pure Rust performance — no JVM warmup, no garbage collection pauses on burst workloads.