# hyperref, natbib and PDF/A-compliance

My e-Thesis submission is required to be in PDF/A-1b format, and I'm having difficulty producing output that meets this standard using LaTeX.

I have successfully typeset a chapter using dvips to produce a PostScript file, which can then be converted to PDF/A using Adobe Distiller (Acrobat Pro v8.1.2), BUT with the following issues:

1. if I use hyperref with coloured links, the conversion fails, because the PS file is not PDF/A-compliant (see below)
2. if I turn on draft mode in hyperref, the resulting PS file can be successfully output to PDF/A using Adobe Distiller, but then I get an error, sometimes 2, while typesetting the bibliography (generated with BibTeX and natbib using a custom bibliography style)

For 1) I have seen references to this known issue: hyperlinks are not incompatible with PDF/A per se, but hyperref does not include all the flags required for PDF/A compliance: http://tug.org/mailman/htdig/pdftex/2008-January/007522.html I tried editing hyperref.sty as suggested, but this did not seem to work for me (either when typesetting using pdftex, or through dvips). Acrobat still complained about missing Print and Annot flags for each link (citation and cross-references).

I can live with 2) for the official version (no links, but at least it will be 'archive-quality'). Nevertheless, the errors are incredibly annoying. Each bibliographic entry produces this error:

    Argument of \hyper@anchorstart has an extra }


and sometimes also:

    Paragraph ended before \hyper@anchorstart was complete.


These errors never happen when typesetting through pdflatex, even in draft mode. I need to produce a PS file for PDF/A-1b conversion, but these errors are a huge pain.

I can't fully disable hyperref, because I use the \autoref{} macro a lot, and I would rather not have to replace all those manually.

I also tried using the pdfx package (using the pdflatex driver), but got some strange errors very early on in the typesetting run:

/usr/local/texlive/2011/texmf-dist/tex/latex/pdfx/pdfx.sty:121: Use of \getTZh
doesn't match its definition.
<inserted text> D:20121114223403-
05'00'
l.121 \expandafter\convertDate\pdfcreationdate


I hope there is enough information above for people to suggest alternatives, or ways to fix the errors. I haven't put together a MWE, but I could probably throw one together if it would help.

I am using TexLive 2011 on a Mac (OS X 10.6.8), document processing in TeXShop using simpdftex, Version 20070809 or pdfTeX, Version 3.1415926-2.3-1.40.12

-
hyperref does have a pdfa option. Did you try that? –  sebschub Nov 15 '12 at 11:48
I could find no reference to a pdfa option for hyperref in the documentation. I tried it anyway and, while no LaTeX errors were generated, the resulting PS file could not be successfully converted to PDF/A using Acrobat Distiller :( Should I be using the pdfa option with the pdftex driver? My only concern there is that there are other issues with the resulting pdf file that may prevent conversion to PDF/A. –  Jonathan Whiteley Nov 15 '12 at 13:55
@JonathanWhiteley The pdfa option is explained (here)[mirrors.ctan.org/macros/latex/contrib/hyperref/README]. Don't have any further experience, though. –  sebschub Nov 15 '12 at 15:52
The pdfa option is new to TeX Live 2012 (I was running 2011). I upgraded to 2012 and ... same thing happened. :( Th pdfa option is still not mentioned in the 'official' documentation, and the language in the Readme suggests it is still experimental. Frankly, I would be happy if I could get draft mode to work without spitting out errors for every single bibliography item with the simpdftex driver :( I am also using the memoir class - does that make a difference? –  Jonathan Whiteley Nov 17 '12 at 18:49
Have you tried \usepackage[pdfa]{hyperref} and made it the last package? –  Lance Helsten Dec 27 '12 at 22:34

I'm not sure if an answer is still of interest. Anyway:

1) I would strongly advise to use the pdfx package:

\usepackage[a-1b]{pdfx}


2) The error in the pdfx package is caused by the way how the timestamp is put together. Depending on your timezone (e.g. UTC+1, UTC-1, etc) you have a different sign there. This causes the issue.

Use of \getTZh doesn't match its definition.


You therefore need to put the pdfx.sty in your working directory and need to adjust that specific line accordingly:

\def\getTZh +#1#2{\edef\xTZh{#1#2}\getTZm} % change - to + if error occurs (due to timezone)


...

T\xHour:\xMin:\xSec+\xTZh:\xTZm}} % change - to + if error occurs (due to timezone)


Alternatively, you may change the timezone of your system.

3) pdfx automatically loads the hyperref package, too. If you want to have a customized hyperref setup, you can use:

\hypersetup{
unicode,
}


In addition to that, you need to provide a color profile and a valid xmp file. Information on this can be found in the pdfx manual. This solution relies on pdftex.

I'm not aware of any solution using dvips.

-

Did you try using pdflatex instead of latex-dvips-ps2pdf?

I am actually in a similar situation as I'm also writing my thesis, and I found it is simpler to just generate a pdf directly. I understand this might disrupt quite a few packages but I've been through that with 25+ packages in my preamble quite successfully.

I'm using TeXLive 2012.

-
I can successfully typeset using either dvips or pdf(la)tex, however: (1) The pdf file resulting from pdftex is not PDF/A - compatible (Acrobat Pro will not convert it). (2) The PS file resulting from dvips output CAN be converted to PDF/A, but only if hyperref is in draft mode (which produces errors on every single bibliography item). I know PDF links are compatible with the PDF/A-1b standard, I just don't know how to get LaTeX to produce them in a way that is compatible. :( –  Jonathan Whiteley Nov 22 '12 at 1:21