37

I am trying to make PDF/A from LaTeX (not from LuaTeX etc.) with TeX Live 2013 on Fedora Linux. This works:

\documentclass{article}

\begin{document}

What cat says? \label{meow}

See question on page \pageref{meow}.

\end{document}

With commands latex, dvips and last

gs -dPDFA -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor
-sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite
-sOutputFile=meow.pdf meow.ps

Now, when I add \usepackage[pdfa]{hyperref} I got validation errors like

dc:description :: Wrong value type. Expected type 'lang alt'.
The XMP property 'dc:title' is not synchronized with the document
information entry 'Title'.
A device-specific color space (Annotation C or IC) without an
appropriate output intent is used.

Documentation of hyperref says

-- result is usually not in PDF/A, because many features aren't controlled by hyperref --

but how to control those?

Should I even try this path? There are alternatives like pdfx. Which path to use?

4
  • If you want a PDF why not using pdflatex? Using pdflatex I got no error. Aug 26, 2013 at 16:02
  • Yes, you get PDF but not PDF/A with pdflatex. Aug 26, 2013 at 16:34
  • 2
    Doesn't tex.stackexchange.com/questions/576/… help?
    – You
    Aug 26, 2013 at 19:20
  • I have read that about pdfx, but didn't figure out how to make it work. Some kind on Hello world -example would be nice. Aug 27, 2013 at 5:41

1 Answer 1

30
+50
  1. Put the color profile eciRGB_v2.icc in the working directory.
  2. Add the flowing code to your preamble:
    \usepackage{hyperxmp}
    \usepackage[pdfa, linktoc=none]{hyperref}

    % ===============================
    % Embedding the color profile.
    % Requires eciRGB_v2.icc in the working directory
    % http://www.eci.org/_media/downloads/icc_profiles_from_eci/ecirgbv20.zip
    \immediate\pdfobj stream attr{/N 3}  file{eciRGB_v2.icc}
    \pdfcatalog{%
        /OutputIntents [ <<
            /Type /OutputIntent
            /S/GTS_PDFA1
            /DestOutputProfile \the\pdflastobj\space 0 R
            /OutputConditionIdentifier (eciRGB v2)
            /Info(eciRGB v2)
        >> ]
    }
  1. Add metadata with hyperxmp and \hypersetup:

    \title{Title}
    \author{First Author, Last Author}
    \hypersetup{%
                 pdfauthortitle={Title of the Author},
                 pdfcopyright={Copyright (C) 20xx, Copyrightholder},
                 pdfsubject={Something},
                 pdfkeywords={Keyword1, Keyword2},
                 pdflicenseurl={http://creativecommons.org/licenses/by-nc-nd/3.0/},
                 pdfcaptionwriter={Scott Pakin},
                 pdfcontactaddress={Street},
                 pdfcontactcity={City},
                 pdfcontactpostcode={101},
                 pdfcontactcountry={Country},
                 pdfcontactemail={email@institute.edu},
                 pdfcontacturl={http://www.institute.edu},
                 pdflang={en},
                 bookmarksopen=true,
                 bookmarksopenlevel=3,
                 hypertexnames=false,
                 linktocpage=true,
                 plainpages=false,
                 breaklinks
             }
    

Everything put together results in a document like this:

    % ===============================
    % Filename: test.tex

    \documentclass{article}
    \usepackage{hyperxmp}
    \usepackage[pdfa, linktoc=none]{hyperref}

    % ===============================
    % Embedding the color profile.
    % Requires eciRGB_v2.icc in the working directory
    % http://www.eci.org/_media/downloads/icc_profiles_from_eci/ecirgbv20.zip
    \immediate\pdfobj stream attr{/N 3}  file{eciRGB_v2.icc}
    \pdfcatalog{%
        /OutputIntents [ <<
            /Type /OutputIntent
            /S/GTS_PDFA1
            /DestOutputProfile \the\pdflastobj\space 0 R
            /OutputConditionIdentifier (eciRGB v2)
            /Info(eciRGB v2)
        >> ]
    }

    % ----------------------------------------------
    % Add metadata
    \title{Title}
    \author{First Author, Last Author}
    \hypersetup{%
                 pdfauthortitle={Title of the Author},
                 pdfcopyright={Copyright (C) 20xx, Copyrightholder},
                 pdfsubject={Something},
                 pdfkeywords={Keyword1, Keyword2},
                 pdflicenseurl={http://creativecommons.org/licenses/by-nc-nd/3.0/},
                 pdfcaptionwriter={Scott Pakin},
                 pdfcontactaddress={Street},
                 pdfcontactcity={City},
                 pdfcontactpostcode={101},
                 pdfcontactcountry={Country},
                 pdfcontactemail={email@institute.edu},
                 pdfcontacturl={http://www.institute.edu},
                 pdflang={en},
                 bookmarksopen=true,
                 bookmarksopenlevel=3,
                 hypertexnames=false,
                 linktocpage=true,
                 plainpages=false,
                 breaklinks
             }

    \begin{document}
    What cat says? \label{meow}
    See question on page \pageref{meow}.
    \end{document}

Which is PDF/A-1b compliant:

Result of online pdf-validation tool

Update: Since the original answer, things have changed several times. For a while luatex85 had to be loaded but today it would break compilation. But it's also not needed anymore. The packages have to be loaded before setting the OutputIntent today.

This works only with pdfLaTeX, LuaHBTeX and LuaLaTeX.

14
  • Thanks, now we are close to solution. However, I guess that you mean "compile with latex", not with pdflatex. Also, I still got complains like "The XMP property 'dc:description' is not synchronized with the document information entry 'Subject'." Oct 7, 2013 at 12:54
  • Well, LaTeX + dvips won’t work with ghostscript (only Adobe Distiller), so you have to resort to Dvipdfm instead of dvips.
    – DG'
    Oct 7, 2013 at 14:34
  • dvipdfm gives plenty of warnings, but produces .pdf anyway. But result file has no hyperlinks. gs on my system won't work if input and output files are same. Oct 8, 2013 at 5:56
  • There is, as far as I can see, no good solution for working hyperlinks with your setup. You should really consider using pdflatex instead of plain latex.
    – DG'
    Oct 8, 2013 at 8:38
  • 1
    --> tex.stackexchange.com/a/242314/29873
    – DG'
    May 5, 2015 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.