Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
If you want a PDF why not using pdflatex? Using pdflatex I got no error. –  Raniere Silva Aug 26 '13 at 16:02
    
Yes, you get PDF but not PDF/A with pdflatex. –  Jori Mäntysalo Aug 26 '13 at 16:34
2  
Doesn't tex.stackexchange.com/questions/576/… help? –  You Aug 26 '13 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. –  Jori Mäntysalo Aug 27 '13 at 5:41

1 Answer 1

up vote 19 down vote accepted
+50

Producing PDF/A-1b compliant documents with LaTeX is a difficult business. There seems to be a bug in pdflatex and pdfx is not working properly.

Anyway.

You need to embed a) metadata and b) a color profile.

Embedding metadata with with hyperxmp

Let’s take your example and add metadata with hyperxmp.

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

\documentclass{article}

\usepackage{hyperxmp}
\usepackage[pdfa]{hyperref}

% ----------------------------------------------
% Add metadata

\hypersetup{% 
       pdftitle={Title},
       pdfauthor={Author},
       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}

Now run pdflatex in order to generate test.pdf

Embedding a color profile with ghostscript

  • You need a color profile. Let’s take eciRGB_v2.icc from eci.org

  • To embed the color profile PDFA_def.ps must be customized and put in a place, where ghostscript can find it. (Claudio Beccari wrote a nice article on this topic: XeLaTeX and the PDF archivable format)

%!
% Filename: PDFA_def.ps

/ICCProfile (eciRGB_v2.icc)   % Customize.
def

[ /Title (Title)                  % Customize.
  /DOCINFO pdfmark

% Define an ICC profile :

[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
[{icc_PDFA} <</N systemdict /ProcessColorModel get /DeviceGray eq {1} {4} ifelse >> /PUT pdfmark
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark

% Define the output intent dictionary :

[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
  /Type /OutputIntent             % Must be so (the standard requires).
  /S /GTS_PDFA1                   % Must be so (the standard requires).
  /DestOutputProfile {icc_PDFA}            % Must be so (see above).
  /OutputConditionIdentifier (CGATS TR001)      % Customize
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
  • There is a bug in ghostscript which causes the metadata to be overwritten. So we have to back them up with pdftk: pdftk test.pdf dump_data_utf8 >metadata

  • Run ghostscript: gs -dPDFA -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sOutputFile=test_tmp.pdf PDFA_def.ps test.pdf

  • Now restore the metadata: pdftk test_tmp.pdf update_info_utf8 metadata output test_pdfa.pdf

    Result

Result of online pdf-validation tool

share|improve this answer
    
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'." –  Jori Mäntysalo Oct 7 '13 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 '13 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. –  Jori Mäntysalo Oct 8 '13 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 '13 at 8:38
    
If I start with your example, I get no hyperlinks at all. So, I remove draft-option, and get PDF with hyperlinks. And then, when I use gs-command to PDF, I got PDF that is almost PDF/A, but not exactly; see for example dc:description -error above. –  Jori Mäntysalo Oct 9 '13 at 11:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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