2

I need to fill the page (100%) with the watermark text repeated and rotated under 45 degrees. I should to do it for every page in document. This code works good, but in this case I have only one watermark at center.

\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}

Any ideas or suggestions are welcome?

Thank you for your time and help.

5
  • Welcome to tex.sx. Jun 3, 2020 at 13:50
  • You can try to use \foreach \pos in {...} to set the node on path (current page.north west) -- node[pos=\pos, ...] {...} -- (current page.south east) and use the trick in tex.stackexchange.com/questions/219478/…
    – ZhiyuanLck
    Jun 3, 2020 at 14:02
  • @ZhiyuanLck thanks. I have updated source code in question. But still getting only one line of watermark.
    – Andy
    Jun 3, 2020 at 18:47
  • You mean you want to cover the page with lots of copies from your text? Jun 4, 2020 at 6:52
  • @UlrikeFischer yes, exactly!
    – Andy
    Jun 4, 2020 at 8:03

1 Answer 1

4
\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}

enter image description here

1
  • Great. Thank you so much!
    – Andy
    Jun 4, 2020 at 10:19

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.