You can avoid atbegshi
using the \AddToHook
command. Here is a MWE, taking the tikz
code by Dr. Manuel Kuehner. The output is the same:
\documentclass{article}
\usepackage{tikz}
\usepackage{blindtext}
\AddToHook{shipout/background}{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={circle, minimum height=5mm,minimum width=5mm,draw, xshift = 6mm}]
\draw (current page.west) node[yshift = 30mm]{};
\draw (current page.west) node[yshift = -30mm]{};
\end{tikzpicture}%
}
\begin{document}
\blindtext[6]
\end{document}
EDIT
SebGlav's observation is quite right. In a two-sided document, holes cannot be placed on the left on every page, but left on odd pages and right on even pages. There are two solutions: 1) leave the even pages blank; 2) draw the holes on the right in the even pages
Solution 1) Holes only on odd pages:
\AddToHook{shipout/background}{%
\ifodd\value{page}
\begin{tikzpicture}[overlay,remember picture,every node/.style={circle, minimum height=5mm,minimum width=5mm,draw, xshift = 6mm}]
\draw (current page.west) node[yshift = 30mm]{};
\draw (current page.west) node[yshift = -30mm]{};
\end{tikzpicture}%
\fi
}
Solution 2) Holes on the left and right, respectively, in the odd and even pages:
\AddToHook{shipout/background}{%
\ifodd\value{page}
\begin{tikzpicture}[overlay,remember picture,every node/.style={circle, minimum height=5mm,minimum width=5mm,draw, xshift = 6mm}]
\draw (current page.west) node[yshift = 30mm]{};
\draw (current page.west) node[yshift = -30mm]{};
\end{tikzpicture}%
\else
\begin{tikzpicture}[overlay,remember picture,every node/.style={circle, minimum height=5mm,minimum width=5mm,draw, xshift = -6mm}]
\draw (current page.east) node[yshift = 30mm]{};
\draw (current page.east) node[yshift = -30mm]{};
\end{tikzpicture}%
\fi
}
Solution 2bis) Like above, but saving a few lines of code:
\newcommand{\printholes}[2]{%
\begin{tikzpicture}[overlay,remember picture,every node/.style={circle, minimum height=5mm,minimum width=5mm,draw, xshift = #1}]
\draw (current page.#2) node[yshift = 30mm]{};
\draw (current page.#2) node[yshift = -30mm]{};
\end{tikzpicture}%
}
\AddToHook{shipout/background}{%
\ifodd\value{page}
\printholes{6mm}{west}
\else
\printholes{-6mm}{east}
\fi
}