I would like to add text 'This page intentionally left blank' to blank page (with header) but I would like to this text appear in pdf but not in the printed document. Is it even possible? If so, how?
2 Answers
The pdfcomment package allows you to add PDF annotations to the document which are usually not printed, except if explicitly requested.
Looking at the manual I come up with this example which adds a white page behind the title page to make sure the next content is starting at an odd page.
\documentclass[twoside]{book}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{pdfcomment}
\title{Test}\author{Tester}
% Not sure if this is right, but by default comments should not be printed anyway
%\pdfliteral{%
% /printCommentPopups [/b false]
%}
\begin{document}
\maketitle
\clearpage
\pdffreetextcomment[subject={overlay},height=2.2cm,width=4.8cm,voffset=-2.8cm,hoffset=1.5cm,opacity=1.0,justification=right,type=typewriter,font=Jokerman,fontsize=13pt,fontcolor=black]
{This page was left intensionally blank.}
\thispagestyle{empty}
\cleardoublepage
\blindtext
\end{document}
- 262,582
-
One naive question - what shall be the fate of the text intermediate between \blindtext and \end{document}? Is that also not printed, or is the non-printing exclusively limited to whatever is put within the braces of the \pdffreetextcomment? – 299792458 Sep 25 '15 at 06:44
-
@TheDarkSide: The
\blindtextjust generates some example text and is not part of the solution but only there to have some text. In a real document there would be just your normal content. The empty page is generated by the\clearpageand\cleardoublepagecommands not by\blindtextand only the text in the \pdffreetextcommentis not printed. I guess the 'blind' in\blindtext` caused the confusion on your part, right? – Martin Scharrer Sep 27 '15 at 18:38
This sort of thing is normally accomplished by adding a switch at the top of the preamble (See How to make a switch for print vs. display versions of a document with respect to links/URLs).
Personally I don't like "this page intentionally left blank pages". For starters once the sentence is typeset the page is not blank anymore and it really underestimates the intelligence of readers.
So, I would rather have an epigraph or epigraphs, but modify the code to suit:
\documentclass{book}
\usepackage{epigraph,lipsum}
\makeatletter
\newif\if@print
\@printtrue
\def\cleardoublepage{%
\clearpage
\if@twoside\ifodd\c@page\else
\if@print
\hbox{}
\vspace*{\fill}
\begin{center}
\blankpagetext@cx
\end{center}
\vspace{\fill}
\fi
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage
\fi
\fi\fi}
\def\blankpagetext@cx{\epigraph{We all agree that your theory is crazy.
But is it crazy enough?}{Niels Bohr}}
\begin{document}
\mainmatter
\chapter{Test}
\lipsum[1]
\chapter{Second}
\lipsum[2]
\end{document}
The switch is a simple \if@print.
ocg.stywhich is distributed withAsymptote. – Martin Heller May 28 '12 at 19:21