Skip to main content
Version: 9.x

Validate a PDF

Checks PDFs against PDF/A, PDF/UA or Factur-X, or against PDF/A and PDF/UA together, and lists the violations.

POST/forms/pdf/validate
filesfile[]required

The PDFs.

passwordstring

Opens encrypted PDFs. A wrong one answers 400, and so does a missing one when the PDF has a user password.

profileenum or listrequired

The standard to check against: PDF/A-1a, PDF/A-1b, PDF/A-2a, PDF/A-2b, PDF/A-2u, PDF/A-3a, PDF/A-3b, PDF/A-3u, PDF/A-4, PDF/A-4e, PDF/A-4f, PDF/UA-1, PDF/UA-2 or Factur-X. A JSON array, or the field repeated, checks a PDF/A profile and a PDF/UA one together, as remediate pairs them.

archivesfile[]

ZIP files Gotenberg unpacks: each entry counts as a file uploaded under files.

URLs Gotenberg downloads first, as if you had uploaded the files. Each entry takes a url, and optionally extraHttpHeaders.

JSON, one entry per PDF under its file name.

The route answers directly: it ignores Gotenberg-Output-Filename, and answers 400 to the webhook headers. An error answers a status and a message: see Errors.

curl \
--request POST http://localhost:3000/forms/pdf/validate \
--form files=@invoice.pdf \
--form profile=PDF/A-3b
Response
{
"invoice.pdf": {
"profile": "PDF/A-3b",
"compliant": true,
"violations": []
}
}

profile takes the profiles remediate makes: the PDF/A levels, PDF/UA-1, PDF/UA-2 and Factur-X.

Validate against two profiles​

A JSON array, or the field repeated, checks a PDF/A profile and a PDF/UA one together:

curl \
--request POST http://localhost:3000/forms/pdf/validate \
--form files=@archive.pdf \
--form 'profile=[
"PDF/A-2b",
"PDF/UA-1"
]'
Response
{
"archive.pdf": {
"profile": [
"PDF/A-2b",
"PDF/UA-1"
],
"compliant": true,
"violations": []
}
}

compliant is true only when the PDF conforms to both, and each violation names the standard it breaks in specification. The pairs are the ones remediate makes: another answers 400.

Validate a Factur-X​

curl \
--request POST http://localhost:3000/forms/pdf/validate \
--form files=@invoice.pdf \
--form profile=Factur-X
Response
{
"invoice.pdf": {
"profile": "Factur-X",
"compliant": true,
"violations": []
}
}

The check covers the PDF/A-3b rules of the archival side and the Factur-X rules, the XML's included, and reports warnings for the softer ones of its Schematron, which don't make the invoice non-compliant.

Read the violations​

Each violation names the rule a PDF breaks, and where:

{
"specification": "ISO_19005_2",
"clause": "6.1.7.1",
"testNumber": 2,
"description": "The stream keyword shall be followed either by a CARRIAGE RETURN (0Dh) and LINE FEED (0Ah) character sequence or by a single LINE FEED (0Ah) character. The endstream keyword shall be preceded by an EOL marker",
"context": "object 6: endstream keyword not immediately preceded by an EOL marker",
"severity": "fatal"
}

A fatal violation makes the PDF non-compliant. A warning, which only the Factur-X Schematron rules raise, doesn't.