How to add Background Watermark (Confidential, Draft) in LaTeX?
In this tutorial, you will learn how to add a Background Watermark (Text or Image) in a LaTeX document, including all customization options for watermark.
Here I will use the background package to add a watermark because this package give you a lot of options (color, opacity, angle, etc.) to modify the watermark as you want.
Add watermark for every page in LaTeX
To add “Draft” as a watermark for every page you have to load the package with \usepackage{background}. Take a look.
\documentclass{article}
\usepackage{background}
\usepackage{lipsum} % For dummy text
\begin{document}
\lipsum[1-10]
\end{document}Output:

Set your text as background watermark
In order to set your own text as a background watermark then you can use the \SetBgContents{<text>} option in the preamble. Replace the <text> with any text you want.
\documentclass{article}
\usepackage{background}
\SetBgContents{CodeSpeedy} % Set your text
\usepackage{lipsum} % For dummy text
\begin{document}
\lipsum[1-10]
\end{document}Output:

Set an image as background watermark
To add an image in LaTeX you have to the \includegraphics{<file>} command and load the graphicx package to set the height and width of the image.
Now you can put this command inside the \SetBgContents{} command to use that image as a watermark.
\documentclass{article}
\usepackage{graphicx}
\usepackage{background}
\SetBgContents{\includegraphics[width=0.15\textwidth]{CodeSpeedy-Logo.png}} % Set your image
\usepackage{lipsum} % For dummy text
\begin{document}
\lipsum[1-10]
\end{document}Output:

More customization on the watermark
The background package provides more options to customize the watermark. I listed all of these. Take a look.
| Command | Uses | Value |
|---|---|---|
\SetBgContents{} | Set the background material. | Text or Image |
\SetBgColor{} | Set the color of the background material. | Color Name |
\SetBgAngle{} | Set the angle of the background material. | -360 to 360 |
\SetBgOpacity{} | Set the opacity of the background material. | 0 to 1 |
\SetBgScale{} | Set the size of the background material. | Numeric value |
\SetBgPosition{} | Set the position of the background material. | current page.center (for center),current page.north (for top), andcurrent page.south (for bottom) |
\documentclass{article}
\usepackage{background}
\SetBgContents{Confidential}
\SetBgColor{red}
\SetBgScale{7.5}
\SetBgAngle{55}
\SetBgOpacity{0.6} % Set opacity of watermark (0 to 1)
\SetBgPosition{current page.center}
\usepackage{lipsum} % For dummy text
\begin{document}
\lipsum[1-10]
\end{document}Output:

Watermark only for the first page in LaTeX
If you want to get the watermark only for the first page then you have to use the [firstpage=true] option with the background package. Like this.
\usepackage[firstpage=true]{background}
\documentclass{article}
\usepackage[firstpage=true]{background}
\SetBgContents{Confidential}
\SetBgColor{red}
\SetBgScale{7.5}
\SetBgAngle{55}
\SetBgOpacity{0.6} % Set opacity of watermark (0 to 1)
\SetBgPosition{current page.center}
\usepackage{lipsum} % For dummy text
\begin{document}
\lipsum[1-10]
\end{document}Output:

Leave a Reply