This is a solution using background
and tikz
.
The following MWE presents the crossed lines on even and odd pages. The \includegraphics
is just an extra as illustration of what is flipped and what is not. The first tikzpicture
draws the borders, which may be removed. The second tikzpicture
uses \pgfmathparse
from this answer to change behavior acoordingly to even and odd pages. Both \path[fill=<color>]
are proofs of concept derived from the linked answer. The command \draw
draws the crossed blue lines. I used (+/-<measure>,+/-<measure>)
as a lazy shortcut to display the lines at the same coordinate of the borders. Those points may be replaced for other commands.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage[pages=all]{background}
\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
position = current page.south west,
nodeanchor = south west,
hshift = 1.5cm, % horizontal margin
vshift = 1.5cm, % vertical margin
contents={%
\includegraphics[
height=\dimexpr\paperheight-3cm\relax, % double the vert. margin
width=\dimexpr\paperwidth-3cm\relax % double the horiz. margin
]{example-image-duck}
\begin{tikzpicture}[overlay,remember picture]
\draw [opacity=1,line width=2pt]
($ (current page.north west) + (1.5cm,-1.5cm) $)
rectangle
($ (current page.south east) + (-1.5cm,1.5cm) $);
\end{tikzpicture}
\begin{tikzpicture}[overlay,remember picture, blue]
\pgfmathparse{int(Mod(\thepage,2))}
\let\r\pgfmathresult
\ifnum\r=1
\path[fill=red] (current page.north west) circle (1cm);
\draw [opacity=1,line width=2pt]
($ (current page.north west) + (1.5cm,-1.5cm) $)
--
($ (current page.south east) + (-1.5cm,1.5cm) $);
\else
\path[fill=blue] (current page.south east) circle (1cm);
\draw [opacity=1,line width=2pt]
($ (current page.north east) + (-1.5cm,-1.5cm) $)
--
($ (current page.south west) + (1.5cm,1.5cm) $);
\fi
\end{tikzpicture}
}
}
\begin{document}
\BgThispage
\lipsum[1-20]
\end{document}
current page
coordinates aren't affected by thexscale
. Could you add a little more detail about what you are trying to achieve? It feels like you've simplified it a little bit too far for the question.pgfmorepages
could handle this by putting a mirrored copy of the page, or if it is a single tikzpicture environment then save it in a box and mirror the entire box.