Free tool
Invoice XML in a PDF — Attach or Extract
A tax invoice is two documents in one — the page a person reads and the XML the buyer's accounting system reads — and ZATCA's standard invoice keeps them together by embedding the XML inside the PDF, as Factur-X and ZUGFeRD do in Europe. This attaches one to the other and reads one back out again, including the check almost nothing else does: whether the invoice's own QR code agrees with the invoice it is printed on. The files are opened in this tab and never uploaded.
The invoice never leaves your device.
This embeds the XML correctly: it goes in the EmbeddedFiles tree, where a reader's attachments pane looks, and in the catalogue's associated-files array, which is what the PDF/A-3 convention reads. It does not convert the PDF to PDF/A-3. That needs every font embedded, an output intent with a colour profile, and metadata declaring the conformance level — all properties of how the PDF was produced, which cannot be added to a finished file. Nothing here writes a marker claiming PDF/A-3, because a file that claims it and fails a validator is worse than one that never claimed it.
How to use it
- To attach: drop the PDF and the XML in the first tab, in either order — each file is sorted by what it actually is, not by its name.
- Check the summary that appears, so you can see the invoice number and total before you commit to the pairing. Attaching the wrong XML to the right PDF is the easy mistake to make.
- Set the name the file will be stored under if your recipient requires a particular one, then download.
- To read: switch to the second tab and drop either the PDF or the XML on its own. The XML is pulled out of the PDF for you.
- Read the QR comparison at the bottom, which is the part worth your attention — it says whether the code printed on the invoice describes that invoice.
How it works
A PDF can carry other files inside it. The XML is written into the document's EmbeddedFiles name tree, which is what a reader's attachments pane shows, and referenced again from the catalogue's associated-files array, which is what the PDF/A-3 convention expects. Some producers write only one of the two, so both are read when extracting — an extractor that checks a single place will report “no XML” on an invoice that plainly contains one.
Reading the invoice ignores namespace prefixes and matches on element names, because every producer picks its own prefixes and none of them change what a field means. The parser refuses a document type declaration outright rather than ignoring one: an invoice has no legitimate use for a DTD, and entity expansion is how XML parsers are attacked.
The comparison decodes the QR's Tag-Length-Value structure and lines it up against the invoice. Amounts are compared as numbers, so 287.5 and 287.50 agree; timestamps are compared as instants, so a time written with a +03:00 offset agrees with the same moment written in Zulu. Names are compared as text with only the spacing forgiven — a registered name is a registered name.
Part of the topic PDF Tools That Never Upload Your File
Common questions
How do I attach the XML to a PDF invoice for ZATCA?
Drop both files into the first tab and download the result. The XML is embedded as an associated file, which is the structure ZATCA's standard invoice and Europe's Factur-X both rely on, and any extractor will find it.
Does this produce a PDF/A-3 file?
No, and it says so on the page rather than in the small print. The attachment structure is complete and correct, but PDF/A-3 also requires every font embedded, an output intent with a colour profile, and metadata declaring the conformance level — all decided when the PDF was made. No marker claiming PDF/A-3 is written, because a file that claims it and then fails a validator is worse than one that never claimed it. If your buyer requires validated PDF/A-3, produce it in your invoicing system.
How do I extract the XML from a PDF invoice a supplier sent me?
Use the second tab and drop the PDF. If the XML is inside, it is pulled out, shown field by field, and offered as a download. If the PDF has no attachments at all, the tool says so — most PDFs of invoices genuinely do not carry the XML, and it has to come from the supplier.
Can it check whether the QR code matches the invoice?
Yes, and that is the part worth using it for. The QR inside a ZATCA invoice is Base64 TLV holding the seller name, VAT number, timestamp, total and VAT. Each is decoded and compared with the invoice's own value, and a difference is reported field by field. A QR generated before a total was edited still scans perfectly and describes a different invoice.
ZATCA QR Code Generator & Reader →Does it verify the invoice's signature?
No. Reading whether a signature block is present is easy and is reported; verifying it needs the certificate chain from your ZATCA-issued certificate and the canonicalised document hash, which is work for your e-invoicing system, not a browser page.
Is my invoice uploaded anywhere?
No. The PDF is opened, the XML is embedded or extracted, and the comparison is run — all in this tab. Open your browser's network tab and use the tool: nothing is sent. That matters more here than on most pages, because an invoice carries a customer, a total and two VAT numbers.