Adding a watermark to a PDF marks the document as confidential, draft, or proprietary. The watermark is a semi-transparent text overlay drawn on every page, visible enough to signal ownership but light enough to keep the content readable.
This guide covers every method: free browser tool, interactive designer, command line, and code (JavaScript + Python), so you can pick what fits your workflow.
What is a PDF watermark?
A PDF watermark is text or an image drawn on top of (or behind) every page of a document. The PDF specification (ISO 32000-1, Section 14.6) defines watermark annotations as a page-level overlay type. Unlike comments or sticky notes, watermarks are part of the page content stream, meaning they appear in print and in every viewer.
Common watermark text:
| Text | Use case |
|---|---|
| CONFIDENTIAL | Internal documents, contracts, financial reports |
| DRAFT | Work-in-progress documents before final approval |
| SAMPLE | Demo copies of paid templates or reports |
| DO NOT COPY | Legal filings, intellectual property |
| Company name | Brand identification on shared documents |
Watermarks serve two purposes: identification (who owns this document) and deterrence (discouraging unauthorized distribution). The global digital watermarking market reached $1.45 billion in 2024 and is projected to hit $3.80 billion by 2033, reflecting how seriously organizations take document provenance.
Watermarks do not prevent access, unlike password protection, which encrypts the file. For the strongest protection, combine both: the password prevents editing (so the watermark cannot be removed), while the watermark identifies the source if the file is shared.
Design your watermark
Before applying a watermark, use the interactive designer below to find the right combination of text, size, opacity, rotation, and position. The preview updates in real time.
Key parameters to consider:
- Opacity: 8-15% for subtle branding, 20-40% for strong deterrence. Higher opacity makes text harder to read.
- Rotation: -45° (diagonal) is the most common angle. It crosses the page corner-to-corner, making it difficult to crop out.
- Font size: 48-72px for A4/letter pages. Scale down for smaller formats.
- Position: center is standard. Bottom-right works for subtle brand stamps.
Method 1: Browser tool (fastest, recommended)
The fastest way to watermark a PDF is PDF4.dev's free browser tool. No software, no account, no file upload to any server.
- Go to Watermark PDF
- Upload your file (drag and drop or click to browse)
- Enter your watermark text
- Adjust opacity and font size
- Click Add Watermark and download
Why it works well:
- The watermark is permanently drawn on every page, not just a viewer overlay
- Files are processed by pdf-lib in your browser, they never reach a server
- No file size limits, no watermarks-on-your-watermark, no account required
Watermark placement patterns
The placement pattern determines how well the watermark resists removal. A single centered watermark can be cropped out by trimming the page. A repeated pattern covers the entire page surface, making removal impractical without damaging the content.
One centered watermark. Best for internal drafts.
| Pattern | Watermarks per page | Removal difficulty | Best for |
|---|---|---|---|
| Single center | 1 | Easy to crop | Internal drafts, light branding |
| Diagonal repeated | 6-10 | Moderate | Shared documents, review copies |
| Grid | 12-20 | Very difficult | Sensitive financials, legal documents |
For maximum protection, combine a grid watermark with password protection. The password prevents editing (so the watermark cannot be removed), while the watermark identifies the document if the password is shared.
Before and after
Drag the slider to compare a document with and without a watermark. Notice how the text remains fully readable at 12% opacity.
At low opacity, the watermark is barely noticeable during normal reading but immediately visible when someone tries to pass the document off as their own. This is the key tradeoff: visibility for deterrence versus readability for the intended audience.
Method 2: Command line with qpdf and Ghostscript
For batch processing or scripting, command-line tools offer more control.
Using Ghostscript
Ghostscript can stamp a watermark from a separate PDF onto every page:
# Create a watermark PDF first (single page with your text)
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \
-sOutputFile=watermarked.pdf \
-c "<</PageSize [595 842]>> setpagedevice \
0.85 setgray /Helvetica-Bold 60 selectfont \
100 400 moveto 45 rotate (CONFIDENTIAL) show" \
-f input.pdfUsing cpdf
cpdf provides a cleaner command for text stamping:
cpdf -stamp-on watermark.pdf input.pdf -o output.pdfFor more control, qpdf's overlay feature can stamp a pre-built watermark PDF onto every page of another document.
Limitations: command-line tools require installation, offer limited font options, and have no preview. They work best for CI/CD pipelines or server-side batch jobs.
Method 3: JavaScript with pdf-lib
pdf-lib is the most popular JavaScript library for PDF manipulation. It runs in Node.js and the browser, has zero dependencies, and handles watermarking in under 20 lines of code. The key method is page.drawText(), which accepts position, font, size, color, rotation, and opacity parameters.
import { PDFDocument, StandardFonts, degrees, rgb } from "pdf-lib";
import { readFileSync, writeFileSync } from "fs";
async function addWatermark(inputPath: string, outputPath: string) {
const doc = await PDFDocument.load(readFileSync(inputPath));
const font = await doc.embedFont(StandardFonts.HelveticaBold);
for (const page of doc.getPages()) {
const { width, height } = page.getSize();
const text = "CONFIDENTIAL";
const fontSize = 60;
const textWidth = font.widthOfTextAtSize(text, fontSize);
const rad = (-45 * Math.PI) / 180;
page.drawText(text, {
x: width / 2 - (textWidth / 2) * Math.cos(Math.abs(rad)),
y: height / 2 + (textWidth / 2) * Math.sin(Math.abs(rad)),
size: fontSize,
font,
color: rgb(0.5, 0.5, 0.5),
opacity: 0.15,
rotate: degrees(-45),
});
}
writeFileSync(outputPath, await doc.save());
}
addWatermark("input.pdf", "watermarked.pdf");Custom fonts
The standard fonts (HelveticaBold, TimesRoman, Courier) are always available. For custom fonts, embed them from a file:
const fontBytes = readFileSync("fonts/Inter-Bold.ttf");
const customFont = await doc.embedFont(fontBytes);pdf-lib supports .ttf and .otf fonts. Google Fonts files work after downloading the font file.
Repeated pattern watermark
To create a grid pattern that covers the entire page, loop over a grid of coordinates:
const text = "CONFIDENTIAL";
const fontSize = 24;
const spacing = 200; // pixels between each watermark
for (const page of doc.getPages()) {
const { width, height } = page.getSize();
for (let y = 0; y < height; y += spacing) {
for (let x = 0; x < width; x += spacing) {
page.drawText(text, {
x,
y,
size: fontSize,
font,
color: rgb(0.5, 0.5, 0.5),
opacity: 0.06,
rotate: degrees(-30),
});
}
}
}Method 4: Python with pypdf
pypdf is the standard Python library for PDF manipulation. Watermarking requires two steps: generate a single-page watermark PDF with ReportLab (for the text rendering), then merge it onto every page of the target document using pypdf's merge_page() method.
from pypdf import PdfReader, PdfWriter
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from io import BytesIO
def create_watermark(text: str = "CONFIDENTIAL") -> bytes:
"""Generate a single-page PDF with a diagonal watermark."""
buffer = BytesIO()
c = canvas.Canvas(buffer, pagesize=A4)
width, height = A4
c.saveState()
c.translate(width / 2, height / 2)
c.rotate(45)
c.setFont("Helvetica-Bold", 60)
c.setFillAlpha(0.15)
c.setFillColorRGB(0.5, 0.5, 0.5)
c.drawCentredString(0, 0, text)
c.restoreState()
c.save()
buffer.seek(0)
return buffer.read()
def watermark_pdf(input_path: str, output_path: str):
watermark_bytes = create_watermark()
watermark_page = PdfReader(BytesIO(watermark_bytes)).pages[0]
reader = PdfReader(input_path)
writer = PdfWriter()
for page in reader.pages:
page.merge_page(watermark_page)
writer.add_page(page)
with open(output_path, "wb") as f:
writer.write(f)
watermark_pdf("input.pdf", "watermarked.pdf")Method 5: PDF4.dev API (automated)
For production workflows where PDFs are generated from templates, add watermarks directly in the HTML template using CSS. This avoids a separate watermarking step entirely.
curl -X POST https://pdf4.dev/api/v1/render \
-H "Authorization: Bearer p4_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"template_id": "contract",
"data": {
"client_name": "Acme Corp",
"watermark_text": "DRAFT"
}
}'CSS watermark in your HTML template
Add a watermark layer directly in your Handlebars template using CSS positioning:
<div class="watermark">{{watermark_text}}</div>
<style>
.watermark {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(-45deg);
font-size: 60px;
font-weight: bold;
color: rgba(0, 0, 0, 0.08);
pointer-events: none;
white-space: nowrap;
z-index: 1000;
}
</style>With this approach, the watermark text is a template variable. Pass "DRAFT" during review and remove it (or pass an empty string) for the final version, all from the same template.
Watermark vs password protection
Watermarks and password protection solve different problems. Here is when to use each:
| Feature | Watermark | Password protection |
|---|---|---|
| Prevents opening | No | Yes (open password) |
| Prevents editing | No | Yes (permissions password) |
| Visible in document | Yes | No |
| Identifies source | Yes | No |
| Deters sharing | Moderate | Strong |
| Removable by recipient | Yes, with tools | No, without password |
| Impact on readability | Slight (at low opacity) | None |
Use watermarks when you want the document to be freely readable but traceable: review copies, shared proposals, sample documents.
Use password protection when you want to restrict who can open or edit the file: contracts, financial data, legal filings.
Use both together when the document is sensitive and must be both traceable and access-controlled: confidential financial reports, pre-release legal documents.
Learn more about encryption in the password protection guide.
When to watermark (and when not to)
Good use cases
- Review copies: mark documents as DRAFT until final approval, so recipients know the content may change
- Shared proposals: add your company name to proposals sent to prospects, establishing ownership
- Sample documents: let potential customers preview paid templates with a SAMPLE watermark
- Internal distribution: mark sensitive documents as CONFIDENTIAL to signal handling requirements
- Legal discovery: courts accept watermarked documents as evidence of original authorship when combined with metadata timestamps
Legal protection under the DMCA
In the United States, watermarks qualify as "copyright management information" under 17 U.S.C. Section 1202. Intentionally removing a watermark from a copyrighted document carries civil penalties of $2,500 to $25,000 per violation. Criminal penalties can reach 5 years imprisonment and a $500,000 fine for a first offense.
This makes watermarking more than a visual deterrent: it creates a legal record of ownership that courts recognize.
When watermarks are not enough
- Preventing screenshots: watermarks do not prevent screen captures. If the content is visible, it can be captured.
- Strong access control: use password protection instead. Watermarks do not restrict access.
- Tamper-proofing: digital signatures (not covered here) provide cryptographic proof that a document has not been modified.
Quick reference
| Method | Best for | Opacity | Repeated pattern | Batch support |
|---|---|---|---|---|
| Browser tool | Quick one-off files | Preset (3 levels) | No | No |
| pdf-lib (JS) | App integration, automation | Fully custom | Yes | Yes |
| pypdf (Python) | Scripts, data pipelines | Fully custom | Yes | Yes |
| Ghostscript (CLI) | Server-side, CI/CD | Limited | Manual | Yes |
| PDF4.dev API | Production templates | Via CSS | Via CSS | Yes |
For most users, the free browser tool handles the job in under 30 seconds. For developers building watermarking into an application, pdf-lib (JavaScript) or pypdf (Python) provide full control over every parameter. For production template workflows where PDFs are generated from HTML, the CSS approach via the PDF4.dev API is the cleanest solution.
Need to watermark PDFs at scale? PDF4.dev lets you generate watermarked documents directly from HTML templates via a single API call. The watermark text, opacity, and position are all controlled through CSS and Handlebars variables. Get started free.
Related guides
- How to password protect a PDF: encrypt files so only authorized users can open them
- The complete guide to PDF manipulation: merge, split, compress, rotate, and more
- How to compress a PDF without losing quality: reduce file size after watermarking
- How to generate PDF invoices programmatically: add watermarks to invoices via the API
Free tools mentioned:
Start generating PDFs
Build PDF templates with a visual editor. Render them via API from any language in ~300ms.