Thanks to another post I used


to have a full-sized pdf wallpaper on every page. I also discovered that ocgx2 supports XeLaTeX to create PDF layers, so now I wanted to put the wallpaper into a non-printing layer by surrounding \ThisCenterWallPaper with a \begin{ocg}[printocg=necer]{wallpaper}{wallpaper}{1} (and respective \end) as described here. Unfortunately, either wallpaper seems to "escape" the ocg environment, since the finished pdf has the layer but hiding it doesn't hide the wallpaper, nor does the print preview - the text, however, works.

I tried using other means to include the wallpaper, e.g. background's backgroundsetup with includegraphics, but that always resulted in a non-fullsize wallpaper (possibly due to my using geometry to modify the margins?).

In summary, I'm looking for means to include two pdf files as full-size, non-printing wallpapers (different ones for even and odd pages) in xetex...


This example uses packages ocgx2 (because of XeLaTeX), tikz and atbegshi in order to place non-printable watermarks into the background:



    \begin{tikzpicture}[overlay,remember picture]
      \node [opacity=0.3] at (current page.center) {%




  • I've just seen that ocgx supports XeLaTeX as well. – AlexG Nov 26 '15 at 16:00
  • Awesome, thanks! ocgx needs showingui replaced by listintoolbar though (untested), at least that's what ocgx2's README suggests at a quick glance. That also suggests using \usepackage[tikz]{ocgx2} (instead of the additional \usepackage{tikz}) – Tobias Kienzler Nov 27 '15 at 9:55
  • 1
    [tikz] option is not necessary here. Actually, it replaces the \usetikzlibrary{ocgx} line, which, according to theocgx manual, enables some additional TikZ styles that can be used to associate TikZ scopes with OCGs, and to turn TikZ nodes into clickable buttons for changing OCG visibility. Read the ocgx manual for further details. In general, I recommend using ocgx2 since it extends the ocgx functionality and fixes some bugs inherited from the ocg-p package which ocgx loads under the hood. – AlexG Nov 27 '15 at 10:30
  • There is probably no reason to not use ocgx2 indeed... Why did you choose opacity=0.3 by the way? – Tobias Kienzler Nov 27 '15 at 10:50
  • 1
    As for opacity, I was thinking the background image would look more watermarkish that way. As for showframe, I would experiment with the loading order of the packages. As geometry also modifies the shipout routine via atbegshi, I would try loading geometry just before the document begins. – AlexG Nov 27 '15 at 11:11

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.