As you know, the option ocgcolorlinks of the hyperref package disables colors of all links presented in a PDF file by printing it from Adobe Reader (and by compiling with e.g. pdflatex); as a result, they are printed in a default color.

My questions are:

  1. Is it possible to disable not the color, but entire text (of the link), i.e. that it would be completely disappeared on the printed paper?
  2. Is it possible to do the same with an arbitrary text (i.e. not with the text of the link) or with an arbitrary figure?

What you're looking for is the various ocg* packages, as this kind of features is referred to as »Optical Content Group«. You may want to try out this trippy showcase. What's nice about this method is that the affected passages aren't simply turned white, but are disabled properly. So this is even going to work on a more sophisticated background (such as an image, a gradient fill, etc.).

This is an example using the ocg-p package:


Print me!
Print me! \url{http://tex.stackexchange.com/questions/103824/}

Note the print preview:

print preview with ocg-p

  • Thank you! The ocg-p package is so fresh (of 2013) that I even couldn't find it initially among my MiKTeX packages. Synchronization rules! :) – Jordan Mar 24 '13 at 17:41

ad 1:

hrefhide – Sup­press hy­per links when print­ing

This pack­age pro­vides the com­mand \hrefdis­play­only (which pro­vides a sub­sti­tute for \href). While the (hy­per­linked) text ap­pears like an or­di­nary \href in the com­piled PDF file, the same text will be “hid­den” when print­ing the text. (Hid­ing is ac­tu­ally achieved by mak­ing the text the same colour as the back­ground, thus pre­serv­ing the lay­out of the rest of the text.)


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.