Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"Hiding" interactive parts of pdf when printing

7 views
Skip to first unread message

Heister

unread,
Feb 4, 2010, 9:27:27 AM2/4/10
to
Hi folks!
I'd like to have text being displayed in the pdf, but not appearing when
printing the document (because it is without function there - clicking
does not work with paper yet). Is there a more elegant way than
providing two pdf files: one for on-line viewing and one for printing
the document? And, of course, when printed the space should be blank but
"there", i.e. the layout of the document should not be changed. Just
removing the text would change the pagebreaks and so on, so instead of
"hiding" the text it should really be replaced by a "white box". (It's
no problem if you can e.g. copy the part of the pdf.) Hope it get's
clear what I would like to do.
Kind of a minimal example:

\documentclass{report}
\usepackage[extension=pdf]{hyperref}
\begin{document}
Some text.
\ReplaceWithWhiteWhenPrinting{Click here to so something/go somewhere.}
More text.
\end{document}

Thank you for your help!

Stephan dot Heister -you know what to place here- gmail dot com

Scott Pakin

unread,
Feb 4, 2010, 11:18:58 PM2/4/10
to

There may be a way to do this using a PDF annotation. ISTR that PDF
annotations support a flag that determines whether the annotation should
print.

-- Scott

Heister

unread,
Feb 10, 2010, 7:30:26 AM2/10/10
to
On 05.02.2010 05:18, Scott Pakin wrote:
> There may be a way to do this using a PDF annotation. ISTR that PDF
> annotations support a flag that determines whether the annotation should
> print.
>
> -- Scott

Ok, I'll search for that, thanks!

Stephan

Martin Muench

unread,
Feb 18, 2010, 4:59:07 AM2/18/10
to
Dear Stephan,

you could try the new, experimental option ocgcolorlinks of Heiko
Oberdiek's hyperref package (2010/01/25 v6.80d or newer, see the Readme
of the package):

\documentclass{report}
\usepackage{color}
\usepackage[ocgcolorlinks,extension=pdf]{hyperref}
\listfiles
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
{\color{white} \href{#target}{link to target}}
sed diam nonummy nibh
\newpage
euismod \hypertarget{target}{target text} tincidunt ut laoreet dolore
magna...
\end{document}

When viewing the pdf file, "link to target" is given in red, when
printing the file, the same text is given in white. (If you use another
background colour, you would have to change the colour to make the text
"invisible", of course.)
This method has one drawback: ocgcolorlinks can only be enabled globally
at \usepackage[ocgcolorlinks]{hyperref}, so if you would like to have
other formats for the other links, e.g. red boxes, that is not possible
yet. Maybe Mr Oberdiek reads this and already works at it (please)?

Martin
--
Martin dot Muench at Uni-Bonn dot de

0 new messages