webcapture Get a free key

Watermark an HTML render

The usual advice is a position: fixed div and a hope that print CSS repeats it. A watermark should be on the page, not in the stylesheet's good intentions. The API stamps text on every page after the render, so it cannot be cropped away by a page break.

Why a CSS overlay is not a watermark

Print engines repeat a fixed element per page only when the element's containing block is the page area, and even then the copy can be clipped at a page boundary, hidden by a later stacking context, or skipped entirely by a background-printing setting. On a long document the failure modes compound: the element is drawn once for the flow, and pagination decides what survives.

Worse, a CSS watermark sits in the page's own content. Anyone who can edit the HTML can delete it, and any render that skips backgrounds can lose it.

What the stamp does

The watermark field takes a string of 1 to 120 characters. After the PDF is printed, and before metadata and encryption, the stamp is drawn onto every page of the finished document:

  • 48pt Helvetica-Bold, rotated 45 degrees, centred on the page by its own width and height.
  • 15% opacity, mid grey, so it reads as a mark rather than as content competing with the text.
  • Applied per page after pagination, so it cannot be clipped by a page break and cannot be removed by editing the source.
curl -X POST https://webcapture.io/v1/convert \
  -H "Authorization: Bearer wc_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/drafts/spec",
       "watermark": "DRAFT"}'

The one real limit: the font

The stamp uses a standard PDF font, so it can only draw characters the WinAnsi encoding covers: Latin letters, digits, punctuation and the common accents. CJK, Cyrillic, Greek and emoji are refused with a 422 before the render, with an error that says the text is not encodable.

That is deliberate. A stamp that silently drops glyphs would put a half-rendered word across a legal document. If the mark needs characters the standard font cannot draw, put it in the page as a real element and print it with the content, where the page's own webfont applies.

They answer different questions. The stamp is a diagonal mark over the content: DRAFT, CONFIDENTIAL, a client name. A header or footer is a band outside the content, for page numbers, a document title or a date, and it is set with displayHeaderFooter plus a template. Both can be in the same request.

The stamp is PDF only, like every post-process step. For the page-number case see page numbers in HTML to PDF; for the full parameter list see the API reference.

Frequently asked questions

Can I change the watermark's colour, size or angle?

Not today. The stamp is a fixed treatment: 48pt, 45 degrees, 15% grey, which is what keeps it legible on both text-heavy and image-heavy pages. The field controls the text and nothing else, so two documents watermarked by different teams look like the same system.

Does the watermark apply to PNG captures too?

No. A raster capture is finished pixels, and the stamp is a PDF post-process. For an image, put the mark in the page before capture, or use the clip and viewport controls to frame the region you want.

Is the watermark visible in the extracted text?

The stamp is a text run drawn onto each page, so text extraction can find it. If the mark must not appear in copy-paste output, it should be an image in the source page instead.

Render your first page in seconds

Mint a key, POST a URL, and the finished document comes back in the same response; pass ?wait=false for a job ticket with poll and download URLs. The first 50 renders a month are free, and there is no credit card. Not ready for a key? The free URL to PDF tool renders public pages without one.