I like having my hyperref hyperlinks a different colour, so it's obvious that they are links. But when I print a copy of the PDF, I don't want the links to be coloured, because you can't click them, so it doesn't matter and it's distracting.

Other than just having a separate "for printing" version of the PDF where I turn off the hyperlinks, is there a way to have the printed version come out without the coloured links?

5 Answers 5


Yes. Use


This option must be given when loading hyperref. You cannot give it in \hypersetup.

With this option hypreref will make the colorlinks as Optional Contents Groups (OCG) with /PrintState/OFF and /ViewState/ON. Your pdf reader needs to support OCG.

Also, the default behaviour of hyperref is to draw a coloured box around links. This box does not print.

  • 41
    The ocgcolorlinks does indeed colour the links for the screen version and leave them black for the printed version, but it has some downsides: the links cannot break across lines; any spaces within the links are set at their natural width and not stretched or shrunk to match with the surrounding text. Therefore ocgcolorlinks is really only a good option when the links are short, unbreakable, single words. I've been pondering if there is a way to use the power of the soul package to get around these restrictions, but I haven't spent a lot of time on it.
    – Lev Bishop
    Commented Oct 22, 2010 at 23:42
  • 4
    (Yeah I should have mentioned that I changed the link behaviour from "ugly as hell primary colour boxes" to "sexy subtle dark coloured text")
    – Seamus
    Commented Oct 23, 2010 at 12:32
  • 5
    Perhaps you could incorporate Lev Bishop's comment into your answer, I think it's worth making clear the option has its downsides...
    – Seamus
    Commented Oct 23, 2010 at 12:39
  • 3
    Apropos my older comment, I've actually implemented a hack/patch to hyperref that addresses the two downsides Lev mentioned in his comment. I've emailed the maintainers of hyperref the code; I haven't heard from them yet. I could post the code here if people were interested in testing it themselves, but I make no guarantees to its robustness! :) It should work for any text that appears in a URL, but wouldn't work for, say, rules or graphics content...but those can't go in a URL anyway.
    – Ben Lerner
    Commented Feb 11, 2012 at 6:09
  • 3
    @LevBishop Wow, this is amazing. This is totally OT but could this OCG feature in principle be used to have a color plot on screen but print a dotted line b/w plot? Would also be useful to print photos in a dedicated high-contrast black and white version. Of course color printers are a problem but I don't think there's a PDF feature to solve that problem. Would still be good for journals that require b/w images but put the same PDF online.
    – Christian
    Commented May 17, 2012 at 13:53

Another option, using ocgx2 package:


Similar to hyperref's ocgcolorlinks, but with additional support for

  • dvipdfmx/xelatex
  • dvips
  • breakable links across lines and pages (except dvips), based on Ben Lerners suggestion for line-breakable links

->Example of nested, line and page breaking OCG colour links:

enter image description here enter image description here

  • 7
    Keep in mind that this needs a compatible PDF viewer. Currently it doesn't work on Evince/Okular, but it works e.g. on Adobe Reader and the embedded PDF viewer of Chromium and Chrome.
    – MakisH
    Commented Apr 13, 2017 at 14:26

Try the (experimental) option ocgcolorlinks to the hyperref package. I don't think it's documented in the manual, but see http://www.tug.org/applications/hyperref/ftp/README for a description.


hyperref's option hidelinks will not turn the hyperlinks off, but will just not make them distinguishable from the text.

You still need to make a separate PDF for printing, but at least you can be sure that the links will be printed in text color and break normally.

  • 3
    Noteworthy remark, since only AR and Foxit seem to acknowledge the do-print/do-not-print settings that are associated with the two PDF layers created for this purpose.
    – AlexG
    Commented Apr 11, 2017 at 8:18

Try with this:




While doing "Printer" mode, give the option "printer" in your TeX application file, it will switch off the color links

  • \newif\ifPrinter leaves \Printerfalse initially
    – user31729
    Commented Apr 11, 2017 at 11:08
  • 2
    why have you added dvips option (it does nothing useful if latex=dvips is being used and completely breaks hyperref if pdflatex is being used) Commented Apr 11, 2017 at 13:21

You must log in to answer this question.

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