2

i use \usepackage{draftwatermark} and tcolorbox.

But watermark is hidden by box.

How can put watermark overlay box and different per page: Top secret 1, Top secret 2, Top secret A, B...?

My minimal code:

\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{draftwatermark}
\SetWatermarkText{Top secret 1}
\SetWatermarkScale{4}
\SetWatermarkColor[rgb]{0.7,0,0}
\usepackage[most]{tcolorbox}


\begin{document}



\section{STAMP}

\blindtext

\begin{tcolorbox}[width=\textwidth,height=5cm]

Stamp hidden by box

\end{tcolorbox}

\blindtext
\newpage
\blindtext
\begin{tcolorbox}[width=\textwidth,height=5cm]

Stamp hidden by box

\end{tcolorbox}
\blindtext
\end{document}

enter image description here

Thank in advance

latexforti
  • 2,091

1 Answers1

2

I have no idea what the watermark package precisely does, but you also do not need it when you load tcolorbox. Ordinary tikz, which is included in tcolorbox and eso-pic do the job.

\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{eso-pic}
\usepackage[most]{tcolorbox}
\definecolor{pfrt}{rgb}{0.7,0,0}
\AddToShipoutPictureFG{%
\begin{tikzpicture}[overlay,remember picture]
\path (current page.south west) -- (current page.north east)
 node[midway,scale=6,color=pfrt,sloped] {Top Secrect \number\value{page}};
\end{tikzpicture}
}

\begin{document}
\section{STAMP}

\blindtext

\begin{tcolorbox}[width=\textwidth,height=5cm]

Stamp hidden by box

\end{tcolorbox}

\blindtext
\newpage
\blindtext
\begin{tcolorbox}[width=\textwidth,height=5cm]

Stamp hidden by box

\end{tcolorbox}
\blindtext
\end{document}

enter image description here

  • can you add different stamp for different page: Top secret 1,2,3. Thanks – latexforti Aug 08 '19 at 02:39
  • 1
    @latexforti Yes. –  Aug 08 '19 at 02:51
  • thank so much. It's automatic. Can you edit for hard watermark for each page. Ex: Top Secret 1 or Draft, confidential. Not always Top Secret. Thanks – latexforti Aug 08 '19 at 02:58
  • 1
    @latexforti If you use the starred version \AddToShipoutPictureFG*{% \begin{tikzpicture}[overlay,remember picture] \path (current page.south west) -- (current page.north east) node[midway,scale=6,color=pfrt,sloped] {<your text>}; \end{tikzpicture} } instead of the unstarred one, you can add a water mark per page. Or, if you have a list, this also can be made work, but this requires clear prescriptions from your side. –  Aug 08 '19 at 03:06
  • Sorry, when i use per page. 2. page is duplicated of 2 different watermark. Image: https://imgur.com/eJMxpLe and my code: https://www.codepile.net/pile/lp2GgwPr – latexforti Aug 08 '19 at 03:31
  • 1
    @latexforti You simply forgot the stars: \AddToShipoutPictureFG* instead of \AddToShipoutPictureFG works. That's what I meant by "starred" version. –  Aug 08 '19 at 03:59