Minimal project available also on OverLeaf
-
Use the PDFLaTeX or XeLaTeX compiler
-
Create a
preamble.tex
file and place this into it. Clearly, change the language, metadata, anyhyperref
fields as required.% !TeX encoding = UTF-8 % Document language and font support \usepackage{ifxetex} \ifxetex \usepackage{polyglossia} \usepackage{fontspec} \setmainlanguage{english} \else \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \fi % PDF/A settings \begin{filecontents*}[overwrite]{\jobname.xmpdata} \Title{My Title} \Author{Me Myself} \Language{en-GB} \Subject{My subject} \Keywords{% lorem \sep ipsum \sep dolor} \Copyright{Copyright \copyright My Name} \end{filecontents*} \usepackage[pdfa]{hyperref} \usepackage[a-1b,latxmp,mathxmp]{pdfx}[2019/02/27] \usepackage{colorprofiles} \hypersetup{% unicode=true, pdftoolbar=false, pdfmenubar=false, pdffitwindow=true, pdfstartview={FitH}, pdfnewwindow=true, colorlinks=true, linkcolor=black, citecolor=black, filecolor=black, urlcolor=blue }
Pay attention to:
- load
hyperref
withpdfa
option. colorprofiles
is required- set the PDF/A compliance level to the desired one: I used
a-1b
- add support for characters using the
pdfx
settings: I used extended latin characters and math symbols. More in thepdfx
package documentation
- load
-
Start your main LaTeX document like this:
% !TeX encoding = UTF-8 % REQUIRES XELATEX % Any \PassOptionsToPackage should go here \documentclass{article} \input{preamble.tex} \begin{document} Hello, I'm PDF/A compliant \end{document}
A warning about Writing or overwriting file ./output.xmpdata
is completely normal - ignore it.
It may happen that some package is imported twice in your preamble, especially if you load it within any custom document class first and only then load the preamble. When they need to be loaded with a specific option, you can force it with the line:
\PassOptionsToPackage{option}{packagename}
placed immediately before the \documentclass
call.
Examples:
\PassOptionsToPackage{pdfa}{hyperref}
- ifhyperref
is loaded by document class\PassOptionsToPackage{table}{xcolor}
- ifxcolor
is used to fill table cells backgrounds
- Remove transparency effects from Tikz diagrams.
- Remove transparency effects (alpha) from any used colour.
- Use images without transparency. PNGs should have only solid colours. Replacing them with JPEGs does the trick, if the compression from JPEG is good-enough for your case.
- Download VeraPDF, an open source PDF/A compliance validator. You will need Java to run it.
- Follow the instructions to install it
- and then those to use it
- Select all features in Config > Features
- Choose the PDF file and execute the Validation. In case of errors, select View HTML to see which PDF/A rule was violated. Full rule list.