To reduce the size of a PDF produced with pdflatex I usually run this command:

$ gs -sDEVICE=pdfwrite        \
     -dCompatibilityLevel=1.4 \
     -dPDFSETTINGS=/printer   \
     -dEmbedAllFonts=true     \
     -dSubsetFonts=true       \
     -dFastWebView=true       \
     -dNOPAUSE                \
     -dQUIET -dBATCH          \
     -sOutputFile=out.pdf     \

When I updated Ghostscript to version 25 (9.25), the hyperlinks automatically made by hyperref stopped working: they were not any more clickable.

I tried filing a bug on the Ghostscript bugzilla, where they replied that it is the intended behaviour. See this bug report.

Basically, quoting their answer:

If a /Link Annotation has the 'Print' bit of the annotations /Flags value not set, then the PDF interpreter will (by default) not process the annotation. If the PDF interpreter skips the annotation then the pdfwrite device doesn't ever see it.

If the Annotation (of whatever kind) does set the Print bit, then (again in default setup) the PDF interpreter will process the annotation and pass it to the pdfwrite device.

You can change the behaviour of the interpreter. If you set -dPrinted=false, then the interpreter no longer cares about the Print bit of the annotation flag. In this mode it instead checks the NoView bit, if that isn't set, thenit processes the annotation.

In this case, if the NoView bit was set, then the annotation would be skipped.

So you need to know something about the way the annotation has been created, currently.

The reason this is important is that the control (-dPrinted) which was supposed to control whether or not the annotation is processed was being ignored. Obviously that's not the way it was supposed to work, and has been fixed. Its unfortunate that this causes you a problem, and I may well extend the operation of this control in future, but as of now this is behaving as intended.

With the option -dPrinted=false the links are working again (from Ghostscript's manual):


-dPrinted=false Determines whether the file should be displayed or printed using the "screen" or "printer" options for annotations and images.

With -dPrinted, the output will use the file's "print" options;

with -dPrinted=false, the output will use the file's "screen" options.

If neither of these is specified, the output will use the screen options for any output device that doesn't have an OutputFile parameter, and the printer options for devices that do have this parameter.

$ gs -sDEVICE=pdfwrite         \
     -dCompatibilityLevel=1.4  \
     -dPrinted=false           \
     -dPDFSETTINGS=/printer    \
     -dEmbedAllFonts=true      \
     -dSubsetFonts=true        \
     -dFastWebView=true        \
     -sOutputFile=out.pdf      \

It makes sense to use this switch, since the hyperlinks are not intended to be printed, of course.

But in case I want to set them, how to set the print flag by default on the hyperlinks created by hyperref?

I tried checking the hyperref manual:

PDF form field macros (\TextField, \CheckBox, ...) support boolean flag options. The option name is the lowercase version of the names in the PDF specification (1.7):



Options (convert to lowercase) except flags in square brackets:

  • Table 8.16 Annotation flags (page 608):
    1. Invisible
    2. Hidden (PDF 1.2)
    3. Print (PDF 1.2)
    4. NoZoom (PDF 1.3)
    5. NoRotate (PDF 1.3)
    6. NoView (PDF 1.3)
    7. [ReadOnly (PDF 1.3)] ignored for widget annotations, see table 8.70
    8. Locked (PDF 1.4)
    9. ToggleNoView (PDF 1.5)
    10. LockedContents (PDF 1.7)

but I don't really get how to set them explicitly.

2 Answers 2


I think you can get the Print flag set if you (ab)use the pdfa option.


(see section "5.12 Option pdfa" of the hyperref manual).

This at least seems to work on my local installation (gs 9.25 as required. Without the pdfa option and running your gs command with -dPrinted the hyperlinks are dropped; with the pdfa option the hyperlinks are preserved).

  • Yes, it does. But still wondering how can be done directly. The hyperref manual forgot to do an example... Oct 26, 2018 at 23:03
  • @AlexPacini: I don't think the PDF form fields include hyperlinks. The PDF form fields, as far as I am aware, refers to forms that you can fill out (such as US tax forms). The commands that the flags in section 5.15 refers to are described in Section 7 of the Hyperref documentation. Oct 29, 2018 at 15:11
  • But from table 8.16 the Annotation flags includes the Print one, or not? Oct 29, 2018 at 16:04
  • @Alex: the print annotation flag can be applied to individual PDF form fields using hyperref (at least that's how I read the documentation). That doesn't mean it necessarily can be applied to individual hyperlinks. Oct 29, 2018 at 19:00
  • 1
    No, the pdfa option is not a solution: If it is given, then when one wants to print the PDF file, the boxes around the links are printed, making the document less readable. This is certainly not what one wants!
    – vinc17
    Dec 6, 2018 at 14:43

The OP @alex-pacini asked on the hyperref repo and, two and a half years later :) it was mentioned that it's possible to set the print flag by default on the hyperlinks created by hyperref, but one has to use the "new PDF management":


\bitset_set_true:Nn  \l_pdfannot_F_bitset {Print}
\pdfannot_dict_put:nnn {link/URI}{F} { \bitset_to_arabic:N \l_pdfannot_F_bitset }
\pdfannot_dict_put:nnn {link/GoTo}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }

  • In a current LaTeX you should replace the first two lines by \DocumentMetadata{}. Sep 10, 2023 at 12:27

You must log in to answer this question.

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