PDF/A Conformance Validation Using Linux
PSPDFKit Processor has been deprecated and replaced by Document Engine. To start using Document Engine, refer to the migration guide. With Document Engine, you’ll have access to robust new capabilities (read the blog for more information).
The PDF/A validation API allows you to validate the conformance of a PDF file. It returns a report with the level of conformance of the PDF/A file and the errors encountered during validation.
It’s available on the POST /validate_pdfa
endpoint.
Request Format
The /validate_pdfa
endpoint is a multipart/form-data
request in which you can supply the PDF in two ways:
-
Upload a file as a part of the multipart request.
-
Provide the URL of a PDF file.
To access password-protected documents, include the pspdfkit-pdf-password
header with the value equal to the password of the document. The two ways to supply a PDF are described in detail below.
Uploading a File
Send a multipart/form-data
POST
request and the PDF file that you want to validate to the /validate_pdfa
endpoint. The name of the attached file should be file
. The request looks like this:
Request
$ curl http://localhost:5000/validate_pdfa \ -X 'POST' \ -H "Authorization: Token token=secret" \ -F [email protected]
Providing a URL of a File
Send a multipart/form-data
POST
request with the URL of the file that you want to validate to the /validate_pdfa
endpoint. The value of the url
file part should be the remote URL of the PDF file. The request looks like this:
Request
$ curl http://localhost:5000/validate_pdfa \ -X 'POST' \ -H "Authorization: Token token=secret" \ -F url='https://www.remote-file-url.com/example.pdf'
Response Format
The response of the validate_pdfa
request is a JSON object with details of conformance and a validation report. Here are two examples:
Successful validation
{ "IsValid": true, "Conformance": "PDF/A-2b", "ValidationLog": { "ValidationReport": { "ValidationProfile": { "@Conformance": "PDF/A", "@Part": "2", "@Level": "B" }, "ValidationResult": { "@IsCompliant": "True", "@Statement": "PDF file is compliant with validation profile requirements." }, "Details": { "FailedChecks": { "@Count": "0" } } } } }
Failed validation
{ "Conformance": "None", "IsValid": false, "ValidationLog": { "ValidationReport": { "Details": { "FailedChecks": { "@Count": "1", "Check": [ { "@ID": "MissingXMPMetadata", "@OccurenceCount": "1", "Occurence": { "@Context": "Document", "@ObjReference": "None", "@Statement": "Document XMP metadata is missing." } }, { "@ID": "MissingMarkInfoDictionary", "@OccurenceCount": "1", "Occurence": { "@Context": "Document", "@ObjReference": "None", "@Statement": "MarkInfo dictionary is missing." } }, { "@ID": "MissingStructTreeRootDictionary", "@OccurenceCount": "1", "Occurence": { "@Context": "Document", "@ObjReference": "None", "@Statement": "StructTreeRoot dictionary not found." } } ] } }, "ValidationProfile": { "@Conformance": "PDF/A", "@Level": "A", "@Part": "1" }, "ValidationResult": { "@IsCompliant": "False", "@Statement": "PDF file is not compliant with validation profile requirements." } } } }