13

I came across a line in a LaTeX file reading \pdfoptionsminorversion=6. This changed the minor version of PDF, which I confirmed by looking at the generated PDF. Now, this option doesn't seem to be documented anywhere, so I'm curious. What other options and/or environments exist to control PDF output?

  • 2
    The pdftex manual mentions some obsolete commands, such as \pdfoptionpdfminorversion -- Did you mean that command? – user31729 Sep 20 '14 at 21:03
19

The option is now called \pdfminorversion (since pdfTeX 1.30.0 2005-08-01). It is documented in the pdfTeX manual:

\pdfminorversion (integer) This primitive sets the PDF version of the generated file and the latest allowed PDF version of included PDFs. E.g., \pdfminorversion=3 tells pdfTeX to set the PDF version to 1.3 and allows only included PDF files with versions numbers up to 1.3. The default for \pdfminorversion is 5, producing files with PDF version 1.5. If specified, this primitive must appear before any data is to be written to the generated pdf file, so you should put it at the very start of your files. The command has been introduced in pdfTeX 1.30.0 as a shortened synonym of \pdfoptionpdfminorversion command, which is now obsolete.

Distributions alter the default value here; for example, TeX Live 2010 sets \pdfminorversion=5 when its formats are built, so object compression can be enabled (described below).

It's not entirely correct, because the default value for the current pdfTeX 1.40.15 (without further configuration) is 4. Table 2 shows this correct value.

Some support by packages:

  • Package pdf14 sets the PDF version to 1.4 (i.e. before object stream compression).

  • Package hyperref has an option pdfversion for setting the PDF version.

Other TeX engines/DVI drivers:

  • LuaTeX: \pdfminorversion as in pdfTeX.

    In Lua it is more complicate, because tex.pdfminorversion does not throw an error message, if its setting has no effect, because the version is already written. The very beginning of an PDF file, the PDF header, already starts with the version number (e.g. %PDF-1.5). Example for setting the version to 1.4:

    \directlua{
      if tex.pdfminorversion \string~= 4 then
        if (status.pdf_gone and status.pdf_gone > 0)
        or (status.pdf_ptr and status.pdf_ptr > 0) then
          tex.error("PDF version cannot be changed anymore")
        else
          tex.pdfminorversion = 4
        end
      end
    }
    

    For luatex version 0.95.0 (TeX Live 2016):

    \directlua{
    if pdf.getminorversion() \string~= 7 then
      if (status.pdf_gone and status.pdf_gone > 0)
      or (status.pdf_ptr and status.pdf_ptr > 0) then
        tex.error("PDF version cannot be changed anymore")
      else
        pdf.setminorversion(7)
      end
    end
    }
    
  • dvipdfm(x)

    • Command line option:

      -V number     Set PDF minor version [4]
      

      Example:

      dvipdfmx -V 4 test.dvi
      
    • \special{pdf:minorversion 3} to \special{pdf:minorversion 7} (see comment of AndreKR). If several specials are given, then the latest special on the first page wins and specials after the first page are ignored. Also unsupported values are silently ignored.

  • XeTeX

    • The version can be set by the command line option -V (see dvipdfmx) for the output driver (xdvipdfmx). The option can be passed to the output driver by XeTeX option -output-driver on the command line:

      xelatex -output-driver="xdvipdfmx -V4" test.tex
      
    • \special{pdf:minorversion 3} to \special{pdf:minorversion 7} (see comment of AndreKR). If several specials are given, then the latest special on the first page wins and specials after the first page are ignored. Also unsupported values are silently ignored.

  • Ghostscript provides shorthand commands: ps2pdf12, ps2pdf13, ps2pdf14 can be used to generate PDF files with versions 1.2, 1.3, or 1.4. ps2pdf currently sets 1.4, from the shell script ps2pdf:

    # Currently, we produce PDF 1.4 by default, but this is not guaranteed
    # not to change in the future.
    version=14
    

    The full ghostscript option for setting the PDF version, e.g. 1.4:

    -dCompatibilityLevel=1.4
    
  • Is there an updated place where we could find all those commands documented? – Manuel Sep 20 '14 at 21:10
  • 2
    @Manuel texdoc pdftex? – cfr Sep 20 '14 at 21:12
  • @Manuel I did check and it definitely includes the new version. I wouldn't like to guarantee it doesn't mention the old ones. – cfr Sep 20 '14 at 21:30
  • 1
    For Xe(La)TeX it can also be set from the document using \special{pdf:minorversion 4}. This is the method that the bxpdfver package uses. – AndreKR Jan 22 '16 at 2:59
  • @AndreKR Many thanks, I have updated the answer. – Heiko Oberdiek Jan 23 '16 at 8:53

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.