# 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. – Ulrike Fischer Jul 7 '19 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. – Johan Jul 7 '19 at 13:34
• I am not aware pdfx can do that. But hyperxmp does it by default, see my example in the answer. – tanGIS Apr 7 '20 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. – Johan Mar 30 '20 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. – tanGIS Mar 31 '20 at 9:41
• veraPDF give the error "In order to enable identification of the relationship between the file specification dictionary and the content that is referring to it, a new (required) key has been defined and its presence (in the dictionary) is required." when using embedfile – Johan Apr 5 '20 at 19:17
• 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. – tanGIS Apr 5 '20 at 19:42
• @Johan embedfile 2.10 is out. Adjusted the MWE for it. – tanGIS Apr 16 '20 at 15:33