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}
tanGIS
  • 1,645
  • 15
  • 32
Johan
  • 433

1 Answers1

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.

tanGIS
  • 1,645
  • 15
  • 32
  • 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 Mar 30 '20 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 Mar 31 '20 at 09: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 05 '20 at 19:17
  • 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 Apr 05 '20 at 19:42
  • It works for pdflatex, unfortunately i am stuck with lualatex. Will wait for updated on CTAN. – Johan Apr 07 '20 at 08:29
  • 1
    @Johan embedfile 2.10 is out. Adjusted the MWE for it. – tanGIS Apr 16 '20 at 15:33
  • Thanx, update and it works – Johan Apr 17 '20 at 12:59
  • @tanGIS This is such an eyeopener -- PDF/A is »a PDF with an OutputIntent and certain metadata«. I copied what I needed and after removing the alpha channel from an included picture ( 'mogrify -alpha off filename' ) verapdf was all green! (Whoever reads that, be carefull with mogrify, it overwrites your input file without asking!) – Keks Dose Dec 13 '20 at 20:42
  • 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 Feb 17 '21 at 20:54