- HTML to PDF APIConvert HTML and URLs into PDFsExtract PDF Form Data APIEasily extract data from PDFsWatermark PDF APIAdd custom watermarks to PDFsProtect PDF APISecure your PDFs with passwordCompress PDF APIReduce file size without losing qualityFlatten PDF APIFlatten PDFs to make form permanentDigital Signature APISend documents for signing
- API DocumentationAPI DocumentationFull REST API referenceNodeJS SDKClient library for Node.jsJava SDKClient library for JavaC# SDKClient library for C#PHP SDKClient library for PHPPython SDKClient library for Python
- Pricing
- Contact Us

Watermark PDF API
Add text or image watermarks to PDFs programmatically.
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})();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
FileThe PDF file you want to apply the watermark to. You must provide either this or documentId.
Document Id
StringThe ID of a PDF that already exists in your PDFGate account. Use this instead of uploading a file again.
Watermark
FileThe image file used as a watermark (.png, .jpeg, .jpg). Required if you are adding an image watermark.
Font File
FileA custom font file (.ttf or .otf) to use for text watermarks.
Type
EnumDefines the watermark type. Use text for text watermarks or image for image watermarks.
Text
StringThe text that will appear as the watermark. Required when type is set to text.
Font
StringThe font name for the text watermark. Ignored if a custom fontFile is provided.
Font Size
NumberFont size for the text watermark, in points.
Font Color
StringColor of the text watermark. Can be a hex value (for example #000000) or an RGB value.
Opacity
NumberControls how transparent the watermark is. Values range from 0 (invisible) to 1 (fully visible).
X Position
NumberHorizontal position of the watermark in points. If not set, the watermark will be centered.
Y Position
NumberVertical position of the watermark in points. If not set, the watermark will be centered.
Image Width
NumberWidth to resize the watermark image to, in points. If omitted, the original width is used.
Image Height
NumberHeight to resize the watermark image to, in points. If omitted, the original height is used.
Rotate
NumberRotation angle for the watermark in degrees (0–360). Useful for diagonal watermarks.
Json Response
BoolIf it is set to true, the API will return a JSON response instead of the PDF file.
Pre Signed Url Expires In
NumberExpiration time (in seconds) for the generated temporary download URL.
Metadata
ObjectCustom metadata you want to attach to the document.
Start building with PDFGate today
Generate PDFs, send documents for signature, and automate your document workflows in minutes.
Free trial · No credit card required




