# Generate PDF/A-1b with LuaLaTeX

update since pdfx and hyperxmp are not compatible

I try to use lualatex to generate PDF/A-1b compatible files without creating and xmp file. My attempt does not work.

The pdf is generated but adobe reader does not show that the meta data was set.

MWE:

 \documentclass{article}
\usepackage{luatexbase}

%%%%%%%%%%%% PDF and PDF/A
\usepackage[a-1b]{pdfx}

\hypersetup{%
hyperindex=true,
unicode=true,
pdfauthor={Author},
pdfauthor={Author},
pdfsubject={The Subject},
pdfkeywords={Some Keywords},
pdflang={en},
bookmarksopen=false,
plainpages=false,
pdfpagelabels
}

\begin{document}
\tableofcontents
\section{gg}
gg
\end{document}

• hyperxmp and pdfx are not compatible. Jul 7, 2019 at 13:25
• Does there exist any method to the xmp data of pdfx file that use native latex interface? I want to define title, author, etc only at one place. Jul 7, 2019 at 13:34
• I am not aware pdfx can do that. But hyperxmp does it by default, see my example in the answer. Apr 7, 2020 at 12:34

A PDF/A-1b is a PDF with an OutputIntent and certain metadata. The MWE below does both:

%\pdfobjcompresslevel=0 %uncomment for Texlive
\documentclass{book}

\usepackage[pdfa]{hyperref}
\usepackage{hyperxmp}[2020/03/01]
\usepackage{embedfile}[2020/04/01]

\title{Document title}
\author{First Author, Last Author}

\hypersetup{%
pdflang=la,
pdfapart=3, %set to 1 for PDF/A-1
pdfaconformance=B
}

\embedfile[afrelationship={/Source},ucfilespec={\jobname.tex},mimetype={application/x-tex}]{\jobname.tex}

%Create an OutputIntent in order to correctly specify colours
\immediate\pdfobj stream attr{/N 3} file{sRGB.icc}
\pdfcatalog{%
/OutputIntents [
<<
/Type /OutputIntent
/S /GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (sRGB)
/Info (sRGB)
>>
]
}

\begin{document}
\tableofcontents
\section{gg}
gg
\end{document}


Try using the newer and more straightforward PDF/A-3b since it does not require duplicate metadata.

Tested under MikTeX LuaLaTeX and pdfLaTeX, verified with Acroboat DC, the state of the art PDF/A validator.

• PDF/A does not support that a files (it is a text file) is attached to the pdf. Any suggestion ho to attached a file and still have a complaint pdf. Copy/Paste will not work as the dta stretch over multiple pages. Mar 30, 2020 at 21:29
• This is a new topic. PDF/A-1 does not allow embedded files, but PDF/A-3 does. Just use package embedfile. It's PDF/A-3 compliant. Mar 31, 2020 at 9:41
• You must specify the afrelationship. With today's CTAN version, this does not work with LuaLaTeX. If you use LuaTeX, get the developer version from Github. Apr 5, 2020 at 19:42
• @Johan embedfile 2.10 is out. Adjusted the MWE for it. Apr 16, 2020 at 15:33
• Since this is the premier answer when googling, maybe add a note about \pdfvariable omitcidset=1 (fixes CIDSet issues) and \usepackage[rgb]{xcolor} (ensures RGB for many packages) since they are often required for larger files (like theses). Or alternatively go full CMYK instead of full RGB, i.e. \usepackage[cmyk]{xcolor}. Feb 17, 2021 at 20:54