# PDF Watermark & Page Number Tool (`plainpipe/pdf-watermark`) Actor

Add a text watermark or page numbers to PDFs from links or an upload; returns a link to each stamped PDF. Use when you need DRAFT or CONFIDENTIAL marks on PDFs.

- **URL**: https://apify.com/plainpipe/pdf-watermark.md
- **Developed by:** [Plain Pipe](https://apify.com/plainpipe) (community)
- **Categories:** Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## PDF Watermark & Page Number Tool

Add a text watermark or page numbers to PDFs from links or an upload. Returns one file link per stamped PDF, with page count and size.

### What it does

Give it PDF links or upload a PDF, type a watermark such as `DRAFT` or `CONFIDENTIAL`, and it writes a new, stamped copy of each file to the run's key-value store. The text can run diagonally across the page, sit in the center, along the top or bottom edge, or in the bottom-right corner, with your own font size, opacity, color and rotation. It can also print page numbers such as `Page 3 of 12`, on every page or only on the page ranges you choose.

The original page content is kept as it is; the watermark is drawn on top as real PDF text, nothing is re-rendered or rasterized. All options are checked before any file is fetched, and page ranges are checked against every file before anything is written, so a bad option fails the run with no results and no charge.

### Use cases

- Mark review copies or internal drafts with `DRAFT` before sharing them.
- Stamp `CONFIDENTIAL` along the top edge of every page of a batch of reports.
- Add `Page 1 of N` numbers to handouts, exhibits or merged files.
- Stamp only the first page of each file, for example a cover sheet with `COPY`.
- Run it as a step in an automation: merge files, then stamp them, then pick up the result through the Apify API.

### How to use it

1. Paste direct PDF links into **PDF URLs**, or upload a file in **Upload a PDF**.
2. Type the **Watermark text** and pick a **Watermark position**. Adjust font size, opacity, color and rotation if needed.
3. Optional: set **Pages to stamp** (for example `1-3,5`) and turn on **Add page numbers**.
4. Click **Start**. Each stamped file appears as one row in the dataset; open its `fileUrl` to get the PDF.

### Input

| Field | What it is | Default | Example |
|---|---|---|---|
| `pdfUrls` | Direct links to PDF files, one per line. | none | `["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"]` |
| `pdfFile` | One uploaded PDF, processed after the URLs. | none | a file picked in the input form |
| `text` | Watermark text, up to 200 characters, Latin characters only. Empty = page numbers only. | empty | `DRAFT` |
| `position` | `diagonal`, `center`, `top`, `bottom` or `corner` (bottom-right). | `diagonal` | `top` |
| `fontSize` | Watermark size in points, 4-400. | `48` | `72` |
| `opacity` | 0 (invisible) to 1 (solid). | `0.3` | `0.15` |
| `rotation` | Degrees counter-clockwise, -360 to 360. Not used with `diagonal`. | `0` | `90` |
| `color` | Hex color, also used for page numbers. | `#808080` | `#c00` |
| `pages` | `all`, or ranges such as `1-3,5`. | `all` | `1` |
| `pageNumbers` | Also print page numbers. | `false` | `true` |
| `pageNumberFormat` | `{n}` = page, `{total}` = pages in the file. | `Page {n} of {total}` | `{n} / {total}` |
| `pageNumberPosition` | `bottom-center`, `bottom-right`, `bottom-left`, `top-center`, `top-right`, `top-left`. | `bottom-center` | `bottom-right` |
| `pageNumberFontSize` | Page number size in points, 4-100. | `10` | `9` |
| `outputName` | Base name for the output files, without `.pdf`. | source name plus `-watermarked` | `stamped` |
| `maxItems` | Stop after this many output files. | `100` | `10` |

Example input:

```json
{
  "pdfUrls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"],
  "text": "DRAFT",
  "position": "diagonal",
  "fontSize": 72,
  "maxItems": 10
}
```

### Output

One row per stamped PDF file. Real output of the example input above (the store id is shortened):

```json
{
  "sourceFile": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
  "outputKey": "dummy-watermarked.pdf",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/aBcD1234efGH5678/records/dummy-watermarked.pdf",
  "pages": 1,
  "stampedPages": 1,
  "watermarkText": "DRAFT",
  "position": "diagonal",
  "pageNumbers": false,
  "sizeBytes": 13097
}
```

| Field | Meaning |
|---|---|
| `sourceFile` | The input link the file came from. |
| `outputKey` / `fileUrl` | Key in the run's default key-value store, and a direct link to the stamped PDF. |
| `pages` / `stampedPages` | Pages in the file, and how many of them were stamped. |
| `watermarkText` / `position` / `pageNumbers` | The settings used. |
| `sizeBytes` | Size of the output file. |

### Pricing

Pay per result: **$3.00 per 1,000 results** ($0.003 per result). One result is one stamped PDF file. You only pay for results the Actor returns. Set a maximum total charge on the run to cap your spend.

### Limits

- Files up to 50 MB each. Links must point straight at the PDF file (the response must start with `%PDF-`); redirects are followed.
- Uses the built-in Helvetica fonts, so the text supports Latin characters only (accented Latin letters such as `é` or `ü` work; Cyrillic, Greek, CJK and emoji do not). Other characters fail the run before any file is processed.
- One line of text; line breaks are turned into spaces. Long text is not shrunk to fit the page, so pick a font size that fits.
- Encrypted (protected) PDFs are skipped with a warning and not charged. Files that cannot be fetched or opened are skipped; if nothing usable is left, the run fails.
- A page range past the last page of any file, a bad color code or no text and no page numbers fails the whole run with no results and no charge.
- The watermark is ordinary text drawn over the page; it can be removed with a PDF editor and is not a security feature. Image watermarks are not supported.
- Output files live in the run's key-value store and follow your Apify storage retention settings.

### FAQ

**How much does it cost?**
One result per stamped file, whatever its page count. 1,000 files cost $3.00.

**Why did my run fail with "characters the built-in PDF fonts cannot show"?**
The text has letters outside the Latin set, for example Cyrillic or Chinese. Use Latin letters, digits and common punctuation. Nothing is charged.

**Can I add only page numbers, without a watermark?**
Yes. Leave **Watermark text** empty and turn on **Add page numbers**.

**Can I stamp only some pages?**
Yes. Set **Pages to stamp** to ranges such as `1` or `2-5,8`. Page numbers are printed on the same pages.

**Can I run it on a schedule or from my own code?**
Yes. Use Apify schedules for recurring runs, or start runs and read the dataset and key-value store through the Apify API, the JavaScript or Python client, or integrations such as Make, Zapier and webhooks.

### Legal and data

This Actor processes only what you give it or public, non-personal technical data. It does not log in anywhere, does not collect personal data, and does not bypass paywalls, CAPTCHAs or access controls. You are responsible for having the right to process the inputs you provide.

### Support

Open an issue on the Issues tab. Issues are answered within 14 days. Please include the run ID and the input you used.

Other Plain Pipe document tools: PDF to Markdown Converter, DOCX to Markdown & Text Converter, EPUB to Markdown & Text Converter, PDF Merge & Split Tool, Markdown to HTML Converter, Markdown Table Converter (CSV, JSON, HTML).

**Use this when:** you need to stamp a text watermark such as DRAFT or CONFIDENTIAL, or page numbers, onto one or many PDF files.

### Why this one

- $3.00 per 1,000 results: one result per stamped PDF file; encrypted or unreadable files are not charged.
- The watermark is drawn as real PDF text on top of the original pages, nothing is rasterized; each row has a direct `fileUrl`, page count, stamped page count and size.
- All options and page ranges are checked before anything is written, so a bad option fails the run with no charge. No browser and no proxy needed; the prefill run finishes in a few seconds.
- The prefilled input is test-run daily.

Built and maintained by Plain Pipe.

# Actor input Schema

## `pdfUrls` (type: `array`):

Direct links to PDF files, one per line. Each file gives one stamped PDF. Example: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf. The link must return the .pdf file itself, not a viewer page.

## `pdfFile` (type: `string`):

Or upload one PDF file from your computer, for example contract.pdf. It is processed after the URLs above. Up to 50 MB. Leave empty when you only use PDF URLs.

## `text` (type: `string`):

Text to draw on the pages, for example DRAFT or CONFIDENTIAL. Leave empty to add only page numbers. Latin letters, digits and common punctuation only, up to 200 characters.

## `position` (type: `string`):

diagonal = across the page from bottom-left to top-right (ignores Rotation). center = middle of the page. top / bottom = centered near the top or bottom edge. corner = bottom-right corner.

## `fontSize` (type: `integer`):

Size of the watermark text in points, 4-400. Default 48. Example: 72 for a large diagonal DRAFT.

## `opacity` (type: `string`):

How solid the watermark is, a decimal number written as text from 0 (invisible) to 1 (fully solid). Default 0.3. Example: 0.15 for a faint mark.

## `rotation` (type: `integer`):

Turn the watermark counter-clockwise by this many degrees, -360 to 360. Default 0. Example: 90 for vertical text. Not used with the diagonal position.

## `color` (type: `string`):

Text color as a hex code, for example #808080 (gray) or #c00 (red). Also used for page numbers.

## `pages` (type: `string`):

all, or page numbers and ranges such as 1-3,5. Default all. Pages start at 1. A range past the last page of a file fails the run, with no charge.

## `pageNumbers` (type: `boolean`):

Also print a page number on each stamped page, using the format below. Default off.

## `pageNumberFormat` (type: `string`):

Text of the page number. {n} is the page number and {total} the number of pages in the file. Default: Page {n} of {total}. Example: {n} / {total}.

## `pageNumberPosition` (type: `string`):

Where the page number goes on the page. Default bottom-center.

## `pageNumberFontSize` (type: `integer`):

Size of the page number text in points, 4-100. Default 10.

## `outputName` (type: `string`):

Base name for the output files in the key-value store, without .pdf. Empty = source file name plus -watermarked, for example dummy-watermarked.pdf. With several files a number is added to keep names unique, for example stamped-2.pdf.

## `maxItems` (type: `integer`):

Stop after this many output PDF files. You are charged per output file. Default 100. Example: 10.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "text": "DRAFT",
  "position": "diagonal",
  "fontSize": 72,
  "opacity": "0.3",
  "rotation": 0,
  "color": "#808080",
  "pages": "all",
  "pageNumbers": false,
  "pageNumberFormat": "Page {n} of {total}",
  "pageNumberPosition": "bottom-center",
  "pageNumberFontSize": 10,
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "pdfUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    ],
    "text": "DRAFT",
    "position": "diagonal",
    "fontSize": 72,
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainpipe/pdf-watermark").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "pdfUrls": ["https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"],
    "text": "DRAFT",
    "position": "diagonal",
    "fontSize": 72,
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("plainpipe/pdf-watermark").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "pdfUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  ],
  "text": "DRAFT",
  "position": "diagonal",
  "fontSize": 72,
  "maxItems": 10
}' |
apify call plainpipe/pdf-watermark --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainpipe/pdf-watermark"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/hG53Ix7AjKMRhUAIC/builds/zb6erKyfuWdxWj0Xu/openapi.json
