Validate PDF/A documents using JavaScript

Validate a PDF/A document for compliance and check its conformance level. Supports all PDF/A versions and conformance levels: 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.

JavaScript

1async function main() {
2 const pdfa = await PDFNet.PDFACompliance.createFromUrl(true, filename, '', PDFNet.PDFACompliance.Conformance.e_Level2B, undefined, 10);
3 const err_cnt = await pdfaValidate.getErrorCount();
4 if (errorCountValidate === 0)
5 {
6 console.log('%s: Ok.', filename);
7 }
8}
9PDFNet.runWithCleanup(main);

Convert PDF to PDF/A
Full sample code which illustrates how to validate existing PDF documents for PDF/A compliance as well as to convert generic PDF documents to PDF/A format.

About PDF/A

PDFACompliance class is used to validate PDF documents for PDF/A (ISO 19005:1/2/3/4) compliance or to convert existing PDF files to PDF/A compliant documents.

The conversion option analyzes the content of existing PDF files and performs a sequence of modifications in order to produce a PDF/A compliant document. Features that are not suitable for long-term archiving (such as encryption, obsolete compression schemes, missing fonts, or device-dependent color) are replaced with their PDF/A compliant equivalents. Because the conversion process applies only necessary changes to the source file, the information loss is minimal. Also, because the converter provides a detailed report for each change, it is simple to inspect changes and to determine whether the conversion loss is acceptable.

The validation option can be used to quickly determine whether a PDF file fully complies with the PDF/A specification according to the international standard ISO 19005:1/2/3/4. For files that are not compliant, the validation option can be used to produce a detailed report of compliance violations as well as a list of relevant error objects.

Key Functions:

  • Checks if a PDF file is compliant with any PDF/A specifications (ISO 19005-1, 19005-2, 19005-3, 19005-4).
  • Converts any PDF to a PDF/A compliant document.
  • Supports all PDFA versions and conformance levels: 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, PDFA-4F.
  • Produces a detailed report of compliance violations and associated PDF objects.
  • Keeps the required changes to a minimum, preserving the consistency of the original.
  • Tracks all changes to allow for automatic assessment of data loss.
  • Allows user to customize compliance checks or omit specific changes during the conversion process.
  • Preserves tags, logical structure, and color information in existing PDF documents.
  • Supports user-defined color profiles.
  • Offers automatic font substitution, embedding, and subsetting options.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales