3

I want to have an electronic pdf version that says:

See the game Guillotine (video).

But in the printed version it should just say:

See the game Guillotine.

Is this type of behavior possible? I know about the \usepackage[ocgcolorlinks]{hyperref} option, but changing the color isn't enough.

4

hyperref's ocgcolorlinks option breaks any other OCG (PDF Layer) making package (ocg-p, ocgx), but the closing period and the string "(video)." must be placed on printable/non-printable OCGs on their own in order to meet the requested behaviour.

Pkg ocgx2 re-implements ocgcolorlinks, while allowing the addition of more OCGs using the ocg environment.

Since layers for printing and viewing (OCPrint, OCView) are automatically created when loading ocgx2 with the ocgcolorlinks option, they can be re-opened and used for the closing period and the "(video)." string. (Requires version 0.29 [2017/06/08] of ocgx2.)

\documentclass{article}

\usepackage[urlcolor=red]{hyperref}

%`ocg' environment (PDF Layers); line/page breakable ocgcolorlinks
\usepackage[ocgcolorlinks]{ocgx2}[2017/06/08]

\begin{document}\Huge

See the game \href{https://www.youtube.com/watch?v=ZO8zUJ-suCE&feature=youtu.be&t=26s}{%
  Guillotine\ocglinkprotect{\begin{ocg}{}{OCPrint}{off}\makebox[0pt][l]{.}\end{ocg}}
            \ocglinkprotect{\begin{ocg}{}{OCView}{on}(video).\end{ocg}}%
}

\end{document}

Note that OCG visibility setting for printing is honoured only by Acrobat Reader, a few other non-free viewers and the Chrome/Chromium PDF browser plugin.

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.