3

I tried to set the PDF version to the latest 2.0 standard with:

\special{pdf:majorversion 2}
\special{pdf:minorversion 0} 

XeLaTeX seems to ignore this and produces the PDF with default 1.5 version according to Acrobat reader. Has anyone an idea how to set version 2.0?

8
  • 1
    \special{pdf:majorversion 2} \special{pdf:minorversion 0} hello \bye works for me. The PDF file starts with %PDF-2.0, and Acrobat reports 2.0 as well. Commented Oct 6, 2021 at 14:42
  • Ah interesting! I use TexLive2020 and TeXstudio. Are there any further settings required? Commented Oct 6, 2021 at 14:56
  • 2
    Hm... I don't have TL 2020 at hand to check now, but if I'm not mistaken, support for pdf:majorversion 2 was only added for TL 2021... Commented Oct 6, 2021 at 15:02
  • What platform are you on? It's possible to 'back port' (x)dvipdfmx on Windows at least for this
    – Joseph Wright
    Commented Oct 6, 2021 at 15:08
  • I'm on Windows. But honestly have no idea what backport means. Commented Oct 6, 2021 at 15:16

1 Answer 1

4

This here works fine for me with texlive 2020 on windows:

\RequirePackage{expl3}
\ExplSyntaxOn
\pdf_version_gset:n{2.0}
\pdf_uncompress: % to check the pdf
\ExplSyntaxOff

\documentclass{report}
\begin{document}
abc
\end{document}

\pdf_version_gset:n{2.0} works also with other engines, so I prefer it over the xetex specific command.

The pdf then starts with

%PDF-2.0

hyperref sets the version too. So if you use it you can

  • reset the version after loading it
  • or use the new pdfmanagement and set the version there
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{pdfversion=2.0,uncompress}
\documentclass{report}
\usepackage{hyperref}
\begin{document}
abc
\end{document}
  • or set the version with hyperref. Be aware that hyperref can only do it if no package or code before has already opened the pdf, so you should check if it worked.
\documentclass{report}
\usepackage[pdfversion=2.0]{hyperref}
\begin{document}
abc
\end{document}
2
  • Your approach works for me in contrast to the approach with \special. But as soon as I add \usepackage{hyperref} to your MWE, I get the default version 1.5. Commented Oct 7, 2021 at 6:36
  • 1
    @DanielStich that is one of the reasons why you always should give from the start a complete example. Then people don't have to guess which package you use which interfere. I will add examples with hyperref. Commented Oct 7, 2021 at 7:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .