Produce PDF/A and PDF/X in 2022

pdf-apdfx

As many of us know, there exists a package, called pdfx, originally codeveloped by Hàn Thế Thành, which is supposed to be able to produce PDFs satisfying the PDF/X or PDF/A standards. However, it has not been updated since 2019. This could easily lead you to believe that it is unmaintained. However,
I quote the following comment by Ulrike Fischer:

@Gaussler pdfx is not considered deprecated by us, and it is not unmaintained. It is "only" not compatible with the new pdf management, so you shouldn't use it if you want to use packages like tagpdf or features like expl3-spotcolors which require the pdf management.

So, perhaps it would be great for all of us if we could get a full answer to how we are supposed to produce the PDF standards with LaTeX in 2022 with the new PDF management system?

Best Answer

First a general remark: all PDF standards contain a list of requirements a PDF must fulfill. LaTeX can neither enforce all requirements nor check all of them. If for example a PDF/A standard is wanted, LaTeX can include a color profile or hyperref can disable keys which would insert javascript code, but it can't check graphics for transparency or prevent a user to insert javascript manually. So if you set a standard you have to validate it, e.g. with verapdf or acrobat or a similar tool.

That said with the PDF management you set a standard with the pdfstandard key in \DocumentMetadata. The key can be used more than once to set different standards.

Normally a standard requires also that XMP metadata are added, starting with version 0.95s this is done automatically by the PDF management (it can be suppressed by setting the xmp key to false), for older versions the hyperxmp package should be used.

Currently the standards A-1b, A-2a, A-2b, A-2u, A-3a, A-3b, A-3u, A-4, X-4, X-4p, X-5g, X-5n, X-5pg, X-6, X-6n, X-6p, UA-1 can be set.

If an A-standards is required a color profile is embedded and other requirements are set. The X- and UA-standard currently only add the relevant marker to the XMP-metadata.

PDF/A-4 requires that the PDF version is set to 2.0, and can currently not be created as it needs changes in the engines which will happen in texlive 2023.

All standards ending with a require that the PDF is tagged, this is not enforced yet but for simple (!) documents you can enable it by adding also the testphase=phase-II key.

Documentation is currently in ltdocinit.pdf and l3pdfmeta.pdf of the pdfmanagement-testphase bundle.

\DocumentMetadata{pdfstandard=A-2b} 
\documentclass{book}
\usepackage{hyperref}
\hypersetup{pdfauthor=Ulrike Fischer,pdftitle=pdf/A-2b standard}

\begin{document}
abc
\end{document}

enter image description here

Related Question