Generating PDF/A-1b compliant documents using pdfx and pdfLaTeX

There are several discussions on the web on how to generate PDF/A-1b compliant documents.

One approach can be found on http://support.river-valley.com/wiki/index.php?title=Generating_PDF/A_compliant_PDFs_from_pdftex which is implemented as far as I can see in the pdfx package.

I created a minimal test.tex file:

\documentclass{article}
\usepackage[a-1b]{pdfx}
\begin{document}
Hello, world!
\end{document}


From what I understand, I need to place metadata in a separate file called test.xmpdata:

\Title{PDF/A-Compliance}
\Org{TeX University}
\Keywords{PDF/A}


I compile test.tex using pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian).

For validation of PDF/A-1b compliancy, I use jhove and a PDF export from LibreOffice as a positive control.

jhove -m pdf-hul test.pdf

However, jhove laments

ErrorMessage: Lexical error
Offset: 16530


So my test.pdf file does not seem to be PDF/A compliant. Could you please give me hints on additional diagnostics to run in order to pin down the problem?

• Interestingly, Adobe's Acrobat Reader shows a hint that the generated document would be PDF/A compliant. So maybe this is just a jhove problem. Could maybe someone who possesses Adobe's Acrobat Professional use the Preflight functionality to validate this? But at least pdfinfo test.pdf isn't showing the correct metadata either. Nov 1, 2012 at 10:57
• See also How to create tagged PDF? and LaTeX accessibility Nov 1, 2012 at 11:46
• Nov 1, 2012 at 13:41
• Thanks a lot for your comments so far, but they didn't help me to solve the problem. The thread on width information for rendered glyphs might become important for me if I start using math fonts. Nov 1, 2012 at 19:28
• @PenguinNurse According to Acrobat X Pro's Preflight, small2e.pdf is not a valid PDF/A-1b. You can find a summary here. Nov 14, 2012 at 9:30

See updated solution

https://tex.stackexchange.com/a/535849/50129

OUTDATED

Generating PDFA-1b compliant documents is not possible with the default pdftex. There is a minor bug in pdftex resulting in non-compliant EOL markers. There is a bug report from 2011 about this problem which successfully resolves the issue. You can find it here:

http://sarovar.org/tracker/index.php?func=detail&aid=4341&group_id=106&atid=493

It contains instructions on how to patch pdftex to generate PDFA-1b compatible files. The package also contains a patched version of pdfx. Unfortunately, these changes did not made it into the code base yet.

• This is fixed in the latest Tex Live source! See svn repo and mailing list. Dec 17, 2013 at 16:43
• It seems that the link is not longer working.... Feb 12, 2015 at 16:02
• This answer used to be correct at time of writing but it is completely wrong as of today. How to handle this? Flag down, delete or create a new answer? The problem is a high pagerank. For answers see here. Jun 19, 2020 at 19:10

I had to validate a document through jhove, and I managed to do it using pdftk on the PDF that was produced by pdflatex. I simply used the command

pdftk MyDocument.pdf output ValidatedDocument.pdf


• Well, it would of course nice to create a compliant document directly from TeX or LaTeX. But the good thing about your solution is that it doesn't require proprietary software. Jan 6, 2013 at 14:52
• I totally agree (on both points!). Jan 6, 2013 at 18:06
• -1! This answer is misleading and thus, plain wrong! In no way does pdftk convert a non-PDF/A document into a PDF/A, nor does it really validate a PDF/A document. There is not even a hint in the pdftk documentation which suggests so. Sep 17, 2014 at 16:14
• I am sorry if this answer is misleading. Yet, I really used pdftk to produce a PDF file which was "validated" by jhove as I wrote. I am not sure the resulting PDF is a PDF/A, simply that it passed jhove tests so that my grad school accepted it. Sep 18, 2014 at 7:43

I don't know if this is a right answer to the question, but it might help someone who wants to generate a PDF/A (especially the 1b version for archives) from a LaTeX project.

I tried the pdfx package, even though it helps to reduce the number of validation errors, veraPDF sill complaining about so many others. The problem is LaTeX alone cannot check all the requirements (for example the transparency of the graphics).

After some research I found that Ghostscript can be used to convert a PDF to PDF/A (see this thread), but the validation was not always successful as well. Some versions does not even work. Sometimes it works but the resulting PDF will have some issues (for example links does not work, metadata are removed, etc).

The idea then is to use the pdfx package, compile the project using pdfLaTeX then run Ghostscript on the resulting PDF and use a program like ExifTool to fix the metadata issue. This gave me good results (at least on my LaTeX thesis).

I wrote a simple script to automate the above process. Although I am not sure if it will work for every LaTeX project, but I hope it will help someone in the same situation. The installation process as well as the source code are hosted on github: latex2pdfa