11

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{%
     breaklinks=true,
    hyperindex=true,
    colorlinks=false,
    hidelinks=true,
    unicode=true,
    pdfauthor={Author},
    pdfauthor={Author},
    pdfsubject={The Subject},
    pdfkeywords={Some Keywords},
    pdflang={en},
    bookmarksopen=false,
    linktocpage=true,
    plainpages=false,
    breaklinks,
    pdfpagelabels
 }


 \begin{document}
    \tableofcontents
     \section{gg}
    gg
 \end{document}
3
  • 1
    hyperxmp and pdfx are not compatible. Commented Jul 7, 2019 at 13:25
  • 1
    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
    Commented 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.
    – tanGIS
    Commented Apr 7, 2020 at 12:34

1 Answer 1

12

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.

9
  • 1
    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
    Commented Mar 30, 2020 at 21:29
  • 2
    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
    Commented Mar 31, 2020 at 9:41
  • 1
    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
    Commented Apr 5, 2020 at 19:42
  • 1
    @Johan embedfile 2.10 is out. Adjusted the MWE for it.
    – tanGIS
    Commented Apr 16, 2020 at 15:33
  • 1
    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}.
    – flindeberg
    Commented Feb 17, 2021 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .