Watermark PDF API

Add text or image watermarks to PDFs programmatically.

NODE.JS
CURL
PYTHON
GO
PHP
JAVA
C#
RUBY
1const fs = require("fs/promises");23(async () => {4  const form = new FormData();56  const bytes = await fs.readFile("YOUR_FILE.pdf");7  const file = new File([bytes], "YOUR_FILE.pdf", { type: "application/pdf" });8  form.append("file", file);9  form.append('type', 'text');10  form.append('text', "My watermark!")11  form.append('rotate', "30")12  form.append("font", "helvetica-boldoblique")13  form.append("fontSize", "20")14  form.append('fontColor', "rgba(156, 50, 168)")15  form.append('opacity', '0.2')1617  const res = await fetch("https://api.pdfgate.com/watermark/pdf", {18    method: "POST",19    body: form,20    headers: { Authorization: "Bearer YOUR_API_KEY" },21  });2223  if (res.status === 201) {24    const buf = Buffer.from(await res.arrayBuffer());25    await fs.writeFile("watermarked.pdf", buf);26  } else {27    const text = await res.text();28    console.error(text);29  }30})();
720,000+Documents processed monthly
1,300+Developers using the API
1.6sAverage processing time
99.9%Uptime

Watermark PDF API Overview

Our Watermark PDF API allows you to apply text or image watermarks to existing PDF documents as part of an automated document workflow. It is designed for use cases where PDFs need to be clearly labeled, branded, or protected before being shared, reviewed, or distributed.

Watermarks can be used to indicate document status (such as Draft or Preview), discourage unauthorized sharing, or apply consistent branding across generated documents. The API works on server-side PDFs and integrates easily into existing systems without requiring custom PDF manipulation logic.

This endpoint can be used as a standalone operation or combined with other PDFGate endpoints. A common workflow includes generating a PDF from HTML, applying a watermark for review purposes, and later producing a final, unwatermarked or secured version for distribution.

The Watermark PDF API is suitable for SaaS platforms, internal business tools, and document automation systems that need reliable, repeatable watermarking without manual intervention.

API Parameters

File

File

The PDF file you want to apply the watermark to. You must provide either this or documentId.

Document Id

String

The ID of a PDF that already exists in your PDFGate account. Use this instead of uploading a file again.

Watermark

File

The image file used as a watermark (.png, .jpeg, .jpg). Required if you are adding an image watermark.

Font File

File

A custom font file (.ttf or .otf) to use for text watermarks.

Type

Enum

Defines the watermark type. Use text for text watermarks or image for image watermarks.

Text

String

The text that will appear as the watermark. Required when type is set to text.

Font

String

The font name for the text watermark. Ignored if a custom fontFile is provided.

Font Size

Number

Font size for the text watermark, in points.

Font Color

String

Color of the text watermark. Can be a hex value (for example #000000) or an RGB value.

Opacity

Number

Controls how transparent the watermark is. Values range from 0 (invisible) to 1 (fully visible).

X Position

Number

Horizontal position of the watermark in points. If not set, the watermark will be centered.

Y Position

Number

Vertical position of the watermark in points. If not set, the watermark will be centered.

Image Width

Number

Width to resize the watermark image to, in points. If omitted, the original width is used.

Image Height

Number

Height to resize the watermark image to, in points. If omitted, the original height is used.

Rotate

Number

Rotation angle for the watermark in degrees (0–360). Useful for diagonal watermarks.

Json Response

Bool

If it is set to true, the API will return a JSON response instead of the PDF file.

Pre Signed Url Expires In

Number

Expiration time (in seconds) for the generated temporary download URL.

Metadata

Object

Custom metadata you want to attach to the document.

Integrate in minutes

Use your favorite language with simple REST API endpoints, SDKs, and step-by-step developer guides.

Start building with PDFGate today

Generate PDFs, send documents for signature, and automate your document workflows in minutes.

Free trial · No credit card required