I am working on making my XeLaTeX-compiled PDF file compliant with PDF/X-1a:2001 standard.
When I use this answer with TeXLive 2015, document validates fully (in Acrobat Pro DC). However, when I test same solution on my actual document, which includes chapters, table of contents and other interactivity, I get errors.
I compiled code below with xelatex -output-driver="xdvipdfmx -V 3" pdfx.tex
:
\documentclass{book}
\usepackage{atbegshi}
\AtBeginShipout{
\special{pdf: put @thispage
<<
/TrimBox [0 0 210.990 162.086]
>>
}
}
\special{pdf: put @thispage
<<
/TrimBox [0 0 210.990 162.086]
>>
}
\special{pdf:docinfo
<<
/GTS_PDFXVersion (PDF/X-1:2001)
/GTS_PDFXConformance (PDF/X-1a:2001)
>>
}
\special{pdf:put @catalog
<<
/PageMode /UseNone
/OutputIntents [
<<
/Info (none)
/Type /OutputIntent
/S /GTS_PDFX
/OutputConditionIdentifier (Custom)
/RegistryName (http://www.color.org/)
>>
]
>>
}%
\usepackage{datetime}
\usepackage{hyperref}
\hypersetup{%
pdftitle={Title},
pdfinfo={
ModDate={D:\pdfdate},
Trapped={False},
},
}
\begin{document}
\chapter{Some chapter}
\chapter{Some chapter}
\chapter{Some chapter}
\chapter{Some chapter}
\end{document}
and resulting PDF validation outputs "Document contains actions" error in Acrobat:
Some documents I tested also throw following error: "Annotation inside page area", which points to table of contents generated with \tableofcontents
command and internal links generated with \hyperlink
command. (Hyperlinks are in the document, as basically same source is used for generation of interactive document and print version.)
So problem is interactivity in document.
I tried to disable it by changing
\usepackage{hyperref}
to
\usepackage[draft]{hyperref}
but this not only disables interactivity added by hyperref
, but also skips hypersetup
, which results in document modification date, title and trapped key not being included in compiled PDF. Effect: there is no error regarding interactivity, but document is still not compliant with PDF/X-1a:2001, since it requires hypersetup
metadata to be included.
How can I completely disable all interactivity in a document while still making hypersetup
work?
In theory, I could redefine/overwrite all "interactive" hyperref
commands as well as all my custom commands that use interactivity (at the very end of the preamble, so that all earlier definitions are overwritten):
…
\def \hyperlink#1#2{#2}
\def \href#1#2{#2}
\def \url#1{#1}
\begin{document}
…
but:
- I am not sure how can I disable interactivity of
\pageref
without loosing page number in the document - This approach is very document-specific, as it requires checking where exactly interactivity was added and by which commands
- While it works for some of the documents I tested it with, it doesn't do the trick for MWE above.
Is there any more straightforward/generic way to disable interactivity globally in whole document?
\hypersetup{draft,}
disables interactivity, but it has same side effect as if it was used during package load, that is: missing metadata. I was able to add trapped key using your template, but modification date and title addition eludes me if I try to incorporate only parts of your template that are relevant to this question. Would you be able to modify my MWE only to disable interactivity, without loosing metadata (for XeLaTeX only)?