API V2

Add Text Stamp to PDF

API Endpoint: Text Stamp

Add customizable text stamps and watermarks to PDF documents using the PDF4me Text Stamp API. This powerful tool allows you to create professional watermarks with precise positioning, custom styling, and advanced formatting options. Perfect for document branding, copyright protection, and adding status indicators to your PDF files.

Key Features:

  • Flexible Positioning: Control horizontal and vertical alignment with pixel-perfect accuracy
  • Custom Styling: Choose from various fonts, sizes, colors, and text effects (bold, italic, underline)
  • Advanced Formatting: Set opacity, rotation, margins, and background options
  • Page Targeting: Apply stamps to specific pages or entire documents
  • Print Control: Configure stamps to appear only in print or on screen
  • Professional Results: Create watermarks that enhance document security and branding

  • Method: POST
  • Endpoint: /api/v2/Stamp

Parameters

File NameString, Required

Source file name with proper file extension

File ContentBase64, Required

Map source PDF file content from the previous action

PagesString, Required
  • Specify page indices as comma-separated values or ranges to process (e.g. “0, 1, 2-” or “1, 2, 3-7”).
  • If not specified, the default configuration processes all pages. The input must be in string format.
TextString, Required

The text content that will be displayed as a stamp or watermark on the PDF document. This can be any text string including words, phrases, or sentences that you want to appear as a watermark.

Example:hello

Vertical AlignmentString, Required

Vertical alignment of text stamp. The allowed values are

  • top - top edge of the page
  • middle - equal distance from top and bottom edge of the page
  • bottom - bottom edge of the page
Horizontal Alignmentstring, Required

Horizontal alignment of text stamp. The allowed values are

  • left - left edge of the page
  • center - equal distance from left and right edge of the page
  • right - right edge of the page
Horizontal Margin in mmString, Required

Specify the horizontal margin in millimeters (mm), which is the amount of space added to the left and right sides of an element or page.
Example: 100

Vertical Margin in mmstring, Required

Specify the vertical margin in millimeters (mm), which is the amount of space added to the top and bottom sides of an element or page.
Example: 100

Margin X In PxString, Required

Set the horizontal margin in pixels (px), which is the amount of space added to both the left and right sides of an element or content.
Example: 40

Margin Y In PxString, Required

Set the vertical margin in pixels (px), which is the amount of space added above and below an element or content.
Example: 1

OpacityString, Required

Set the opacity for the watermark. ‘0’ for fully transparent and ‘100’ for fully opaque.
Example: 70

Font NameString, Required

Specify the name of the font to be used for displaying text.
Example: Arial

Font SizeNumber, Required
Default: 12

The font size of the text in the watermark.
Example: 12

isBoldBoolean, Required
Default: No

Indicates whether the text should be displayed in bold style (thicker and darker characters).

  • true
  • false
isItalicsBoolean, Required
Default: No

Indicates whether the text should be displayed in italic style (slanted characters for emphasis or style).

  • true
  • false
underlineBoolean, Required
Default: No

Indicates whether the text should have a line drawn beneath it, called an underline.

  • true
  • false
fontColorString, Required

Specifies the color of the text (font) to control its appearance.
Example - #000000

Rotateinteger, Required

Specifies the angle (in degrees) to rotate an element or text around its center point.
Example: 1

showOnlyInPrintboolean, Required

A setting that makes an element visible only when the document or page is printed, but hides it when viewed on a screen.

  • true
  • false
isBackgroundboolean, Required

A setting that determines whether an element should be treated as a background layer behind other content.

  • true
  • false
transverseboolean, Required

Refers to something oriented or positioned across, perpendicular, or sideways relative to the main direction.

  • true
  • false
fitTextOverPageboolean, Required

A setting that adjusts the size or layout of the text so that it fits perfectly within the boundaries of the page.

  • true
  • false

Output

File ContentBinary

Output file content from PDF4me action

File NameString

Output file name from PDF4me action

Header
Content-Type:application/json
Authorization: Please copy key from the link.

Payload

{
  "alignX": "right",
  "alignY": "middle",
  "docContent": "Please put PDF base64 content",
  "docName": "output.pdf",
  "pages": "all",
  "text": "hello",
  "fontName": "Arial",
  "fontSize": 12,
  "fontColor": "#000000",
  "isBold": false,
  "isItalics": false,
  "underline": false,
  "marginXInMM": "100",
  "marginYInMM": "100",
  "marginXInPx": "40",
  "marginYInPx": "1",
  "opacity": "70",
  "rotate": 1,
  "isBackground": true,
  "showOnlyInPrint": false,
  "transverse": false,
  "fitTextOverPage": false
}

PDF4me API Code Samples

CSharp(C#)
Java
JavaScript
Python
Salesforce
n8n
Google Script
AWS Lambda