3

I'm trying to create a document which contains some special text that's only visible when the document is opened in, e.g., Acrobat. When printing it using a normal printer, I want the text to be removed (or maybe just white-colored). Does anyone here know a way to do so?

Short example:

...
\begin{document}
Hello, this is an example.\\
\printInvisible{This is not visible when printed.}
\end{document}

should give a PDF with this content

Hello, this is an example.
This is not visible when printed.

but lead to the following paper-printed document

Hello, this is an example.

Thank you so much for helping me out!

Best,

Chris

Chris
  • 61

2 Answers2

3

Found a solution to the problem.

It was necessary to load the ocg-p package before hyperref. The following code (assuming standard document class etc.) worked for me:

...
\usepackage{ocg-p,hyperref}
\begin{document}
This text is always visible

\begin{ocg}[printocg=never]{layername}{layerid1}{on}
This text is visible in view mode, and it is removed when printing.
\end{ocg}
\end{document}


Chris
  • 61
0

try the following

\documentclass[12pt]{article} \usepackage{ocgx2} \usepackage{hyperref} \begin{document} This text is always visible \begin{ocg}[printocg=never]{layername}{layerid1}{on} This text is visible in view mode, and it is removed when printing. \end{ocg} \end{document}