1

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

  • 3
    see the ocgx2 package. It allows you to add layers. – Ulrike Fischer May 18 at 12:31
1

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}


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.