iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To create a Factur-X or ZUGFeRD invoice from HTML, render the invoice as a PDF, make that PDF conform to the required PDF/A-3 level, then embed and associate the EN 16931 XML with matching attachment details and Factur-X metadata. Validate the PDF/A container and the invoice XML separately, then check that the visible PDF and XML describe the same transaction. An XML attachment alone does not make a conforming hybrid invoice.
What you are building
A Factur-X / ZUGFeRD invoice is a hybrid document: the PDF is for people to read, while embedded XML carries structured invoice data for software. PDF/A-3 provides a PDF container that can include associated files. Conformance therefore has several distinct parts: the PDF/A container, the XML document and its applicable invoice rules, and the connection between the attachment and the PDF’s metadata.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
PDF Explained: The ISO Standard for Document Exchange | $14.41 | Buy on Amazon |
| 2 |
|
Adobe Acrobat 6 PDF For Dummies | $13.00 | Buy on Amazon |
| 3 |
|
Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware... | $13.39 | Buy on Amazon |
HTML is the starting point for the visible invoice, not a substitute for any of those requirements. The final rendered PDF and the embedded XML must each be correct, and they must represent the same invoice.
Build the invoice in a controlled sequence
Keep rendering, archival preparation, attachment, metadata, and validation in that order. This reduces the chance that a change made late in the process invalidates an earlier check.
#1 Best Overall
-
Render the complete HTML invoice
Generate the PDF only after the invoice content, page layout, fonts, and any overlays are final. A later stamp or other modification can introduce fonts or content after the PDF/A preparation step, so it must not bypass the final validation gate.
-
Prepare the PDF/A-3 container
Make the rendered PDF conform to the PDF/A-3 conformance level your project requires. The implementation example described in a vendor-authored article uses PDF/A-3b, but that example does not establish that 3b is right for every deployment. PDF/A preparation includes requirements such as PDF/A metadata, an output intent and color profile, and embedded fonts, along with other applicable constraints.
If your embedding library expects a prepared PDF/A file, normalize or create that file before adding XML. Do not assume that attaching a file will turn an ordinary PDF into a PDF/A document.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Embed and associate the XML at document level
Add the invoice XML as a document-level associated file, not merely as an arbitrary attachment. The technical overview by PDFlib describes use of the PDF associated-files mechanism (
/AF) alongside the regular attachment listing. For Factur-X, the overview identifiesfactur-x.xmlas the filename; confirm the required filename for the exact release and profile you implement. -
Set the attachment relationship deliberately
Choose the associated-file relationship required for the relevant format version, profile, and transaction context. Do not accept a library default without checking it. A vendor-authored implementation article reports using
Alternativefor its EN 16931 case and notes that defaults vary by library and profile. PDFlib’s overview records a specialSourcecondition for ZUGFeRD 2.1, which is historical guidance rather than a rule to copy into every current document. -
Write matching Factur-X XMP metadata
The PDF’s XMP metadata must declare the appropriate Factur-X information, and the custom XMP schema must be declared through PDF/A’s extension mechanism. The implementation article names
DocumentType,DocumentFileName,Version, andConformanceLevelas properties to handle. Confirm their exact spellings, values, namespace, and extension-schema declaration against the specification package for your target edition.Rank #2
Use the format’s serialized labels, not an internal library enum copied blindly. The implementation article distinguishes API profile keys from XMP labels, noting that labels such as
BASIC WLandEN 16931include spaces.DriversOutdated Drivers Are Slowing You DownPerformancePC Slower Than It Used to Be?DriversCrashes, No Sound, or Screen Glitches?Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Run the validators and inspect their reports
Validate PDF/A conformance with a PDF/A validator such as veraPDF. Separately check that the XML is well-formed, conforms to the expected schema, and satisfies the applicable EN 16931 and national business rules. Mustang can be part of the invoice-structure and data-checking stage; read its detailed report rather than treating a single overall status as proof that every layer passed.
-
Compare the two representations
In your own application, check that the rendered invoice and XML agree on parties, dates, line items, quantities, totals, tax, currency, and payment details. A PDF/A validator cannot prove the XML is the right invoice, and XML schema or business-rule validation cannot prove that it matches the visible PDF.
Keep the format, attachment, and metadata aligned
Filename, associated-file relationship, XMP metadata, XML content, profile, and format version are related settings. Treat them as one configuration, driven by the exact Factur-X / ZUGFeRD release and profile you intend to produce. A document can contain valid XML yet still have the wrong attachment identity or metadata for its declared format.
- Confirm the edition and profile: use the official artifacts for the precise format release and profile selected for your project. Do not carry forward values from an older ZUGFeRD or Factur-X edition without checking whether they still apply.
- Match the declared profile to the payload: the XML, XMP conformance declaration, and profile-specific requirements should all describe the same output. Internal API keys and serialized metadata labels may differ.
- Declare custom XMP correctly: adding custom properties is not enough; PDF/A extension-schema information must describe the custom namespace and its properties.
- Check the relationship instead of inheriting it: relationship behavior can differ by library, profile, and version. Establish the required value from the current specification rather than relying on a default or a historical example.
What veraPDF and Mustang can—and cannot—establish
Think in independent validation gates, not one green status. PDF/A conformance and invoice-data validation answer different questions.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Check | What it addresses | What it does not establish by itself |
|---|---|---|
| veraPDF or another PDF/A validator | Whether the PDF satisfies the PDF/A conformance rules tested by that validator and selected profile. | Whether the embedded XML is a valid invoice, follows applicable business rules, or matches the visible PDF. |
| XML well-formedness and schema checks | Whether the XML can be parsed and conforms to the relevant XML structure. | Whether the invoice data satisfies every applicable business rule or reflects the visible invoice accurately. |
| Mustang and applicable invoice-rule checks | Invoice structure and data checks reported by the tool and configuration in use. | That every PDF/A check passed, unless that result is independently established and clearly included in the report. |
| Application-level comparison | Whether key visible invoice values agree with the embedded XML for the transaction. | The truth of the underlying business facts or conformance checks not included in the application’s comparison. |
A vendor-authored implementation article published September 8, 2026 reports a Mustang behavior in which an overall validity variable is derived from XML validity while the PDF/A result is reported separately. This is a version-specific source-code observation, not a universal claim about all Mustang releases. Check the exact version you deploy and keep an independent PDF/A pass as a release requirement.
Rank #3
- Used Book in Good Condition
That article also cautions that schema validity does not, on its own, settle tax compliance or the sender’s responsibility for invoice content. Treat that as an implementation warning, not a substitute for the rules applicable to your jurisdiction and transaction.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose an implementation route by its responsibilities
The tools below represent approaches documented in the cited technical material, not a claim that one is universally best or current for every profile. Before adopting any route, establish whether it creates PDF/A-3 or only preserves an existing PDF/A file, how it handles attachment association and current metadata, what validation it performs, and what its deployment and licensing require.
| Route | Documented capability | Questions to settle before production |
|---|---|---|
| Mustangproject tooling | The Mustangserver manual describes combining CII XML with an input PDF/A document to produce a Factur-X / ZUGFeRD PDF/A-3 file. | The manual located is version 1.7.0. Confirm current versions, supported profiles, runtime and integration needs, and the scope and meaning of its validation reports. |
| FPDF extension | Its documentation describes XML embedding and supported profile labels. | The extension documentation explicitly says, “No validation is performed on the XML file.” Plan separate PDF/A and XML/business-rule checks, and account for PDF/A font requirements. |
| PDFlib | Its technical overview documents PDF/A-3 creation, XML embedding and association, and Factur-X examples. | Confirm current release and profile support, licensing, and whether its behavior matches your required association and validation workflow. Historical examples in the overview are not current normative authority. |
| Python-oriented pipeline | A vendor-authored implementation article describes Chromium with Playwright for HTML rendering, pikepdf for PDF/A-3 preparation, the Python factur-x library for embedding, and veraPDF and Mustang for validation. |
Check library defaults, relationship behavior, current compatibility, and whether each stage actually performs the checks your release gate requires. The article’s author disclosed being the founder of PDFik, a hosted HTML-to-PDF service. |
Choose based on your language and runtime, whether you need to create or only preserve PDF/A-3, support for your current target profile, clarity of diagnostic reports, XML and business-rule validation coverage, and licensing or operational constraints. A library that embeds the XML may still leave validation and semantic comparison to your application.
Recommended Free Tools
Make validation a production gate
Do not release an invoice because a command exited successfully or a summary says “valid.” Require a record for each independent check, retain the detailed reports, and make failures actionable.
- Require a passing PDF/A result for the final PDF after XML attachment and any other modifications.
- Require XML parsing and schema checks against the intended invoice syntax, plus applicable EN 16931 and national business rules.
- Inspect the validator report to see exactly which checks ran and whether a PDF/A result is separate from the invoice-data verdict.
- Verify attachment name, document-level association, relationship, XMP properties, profile, and version against the selected official package.
- Compare visible and structured values before delivery, especially parties, line items, totals, taxes, currency, and payment details.
The vendor-authored pipeline article says it read Factur-X 1.07.2 / ZUGFeRD 2.3.2 dated November 15, 2024, but had not read a newer release it referenced. The Mustangserver manual located is version 1.7.0, and PDFlib’s overview includes historical details such as ZUGFeRD 2.1. These sources are useful for implementation pitfalls and concepts, but they do not establish the normative requirements or current compatibility of a later release. Confirm the exact current official Factur-X / ZUGFeRD package and profile before shipping.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

