我需要用重复并旋转 45 度的水印文本填充整个页面 (100%)。我应该对文档中的每一页都这样做。此代码运行良好,但在这种情况下,我只有一个位于中心的水印。
\documentclass{article}
\usepackage{tikz}
\usepackage{pdfpages}
\pagestyle{empty}
\newcommand{\filename}{/home/Documents/c.pdf}
\newcommand{\watermark}{\tikz[remember picture, overlay] \node [black,opacity=0.1,rotate=45,scale=4.0] at (current page.north west) {This is watermark text to repeat again and again} -- (current page.south east);}
\begin{document}
\foreach \index in {1,...,\the\pdflastximagepages}
{
\includepdf[pages=\index,pagecommand={\watermark}]{\filename}
}
\end{document}
欢迎任何想法或建议吗?
感谢您的时间和帮助。
答案1
\documentclass{article}
\usepackage{tikz}
\usepackage{pdfpages}
\pagestyle{empty}
\newcommand*\watermarktext[1]{\leavevmode\hbox to 2\textwidth{\leaders\vbox to 2\textheight{\leaders\hbox{#1}\vfil}\hfil}}
\newcommand{\watermark}{\tikz[remember picture, overlay]
\node [black,opacity=0.1,rotate=45,scale=4.0] at (current page.center)
{\watermarktext{This is watermark text to repeat again and again}};}
\begin{document}
\includepdf[pages=1,pagecommand={\watermark}]{example-image}
\end{document}