ScreenshotNeo

BlogHow-to

How to Set the DocRaptor Test Mode Watermark

Set DocRaptor’s document-level `test` option to `true` to watermark test PDFs. Learn how to turn test mode off and what else it changes.

By the ScreenshotNeo team4 October 20265 min read

Set the document-level test option to true in your DocRaptor request. DocRaptor test-mode PDFs are watermarked automatically. To generate a PDF without that test watermark, set test to false or omit the optional setting; the API reference lists false as its default. DocRaptor’s Test Documents documentation also says test documents are unlimited on all plans and do not count against plan limits.

Set test mode in a DocRaptor request

Put test: true in the document options sent to DocRaptor. For example, this JSON describes a test PDF made from HTML content:

{
  "type": "pdf",
  "document_content": "<h1>Preview</h1>",
  "test": true
}

The option belongs to the document request. With a client library, set its corresponding test or setTest option. The API reference also accepts document_url instead of document_content; supply one of these sources for the document. See the DocRaptor API parameter reference.

cURL

This direct API request sends a test document and saves the PDF response. Replace the placeholder with your DocRaptor API key.

curl --user "YOUR_API_KEY:" \
  --header "Content-Type: application/json" \
  --data '{"doc":{"type":"pdf","document_content":"<h1>Preview</h1>","test":true}}' \
  https://api.docraptor.com/docs \
  --output preview.pdf

Python

Using the requests package, send the document options as JSON and write the response bytes to a PDF file.

import requests

api_key = "YOUR_API_KEY"
payload = {
    "doc": {
        "type": "pdf",
        "document_content": "<h1>Preview</h1>",
        "test": True,
    }
}

response = requests.post(
    "https://api.docraptor.com/docs",
    auth=(api_key, ""),
    json=payload,
    timeout=90,
)
response.raise_for_status()
with open("preview.pdf", "wb") as pdf:
    pdf.write(response.content)

Node.js

This example uses the built-in fetch API and writes the returned bytes. Set YOUR_API_KEY in your environment before running it.

import { writeFile } from "node:fs/promises";

const apiKey = process.env.DOCRAPTOR_API_KEY;
if (!apiKey) throw new Error("Set DOCRAPTOR_API_KEY first");

const response = await fetch("https://api.docraptor.com/docs", {
  method: "POST",
  headers: {
    Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString("base64")}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    doc: {
      type: "pdf",
      document_content: "<h1>Preview</h1>",
      test: true,
    },
  }),
});

if (!response.ok) {
  throw new Error(`DocRaptor returned ${response.status}: ${await response.text()}`);
}
await writeFile("preview.pdf", Buffer.from(await response.arrayBuffer()));

Choose test or production output

Request setting PDF result Other documented effects
test: true Watermarked Excel output is cut off after 20 rows. Hosted documents are limited to five downloads and expire after one day. Test documents do not count against monthly limits and are unlimited on all plans.
test: false No automatic test-mode watermark Generated outside test mode, so the documented test-mode constraints do not apply.
Omit test No automatic test-mode watermark; the API reference lists false as the default Same default behavior as false.

These settings apply to document generation, not just PDF styling. If you are validating a spreadsheet beyond 20 rows or need a hosted document to remain available for more than one day or five downloads, generate outside test mode.

Automatic watermark and custom watermark are different

The automatic watermark comes from setting test to true. DocRaptor’s reviewed API reference and test-document guide do not document a setting to change or suppress that automatic mark while keeping test mode enabled. For an unwatermarked result, set test to false or omit it.

A custom text or image watermark is separate: it is markup and styling added to your document content. DocRaptor’s watermark tutorials describe those techniques, and its text-watermark example warns that test-mode watermarks override the custom watermark. Do not treat custom watermark markup as a way to remove the automatic test mark. See the text watermark tutorial and image watermark tutorial.

Or skip the browser setup

If your goal is to capture a web page as an image or PDF rather than generate a PDF from HTML, ScreenshotNeo is a website screenshot API and MCP server. It accepts one GET request with a URL. For example, save a website screenshot as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API docs for the request options. Cookie banners are accepted and removed before the shot, along with known newsletter popups and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are never billed. Its MCP server lets AI agents use screenshot tools. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up free for 1,000 screenshots a month, no card required.

Troubleshooting

Symptom Likely cause Fix
The PDF has a watermark. The document request enabled test mode with test: true. Set test to false or omit it to generate without the automatic test watermark.
The document setting seems ignored. The option may not be in the document options sent to the API, or the client library may use a differently named setter. Inspect the serialized request. Set the document-level test option (or the client’s corresponding test/setTest option).
An Excel test output stops at 20 rows. Test mode truncates Excel documents after 20 rows. Set test to false or omit it when checking the complete spreadsheet.
A hosted test document cannot be downloaded again or has expired. Test hosted documents are limited to five downloads and expire after one day. Generate outside test mode when you need those test-mode constraints removed.
The PDF contains your custom watermark as well as an unexpected mark, or the custom mark is overridden. Custom watermark content does not suppress the automatic test-mode watermark; DocRaptor says test-mode watermarks override the custom text-watermark example. For a clean production PDF, disable test mode. Add a custom watermark separately only when that is the intended output.
The saved file is not a readable PDF. The request may have failed and returned an error response, or the client may have handled the response as text rather than binary. Check the HTTP status and error body before writing the file. Save successful response bytes in binary mode, as in the Python and Node.js examples.

Performance, reliability, and cost considerations

  • Test iterations: DocRaptor documents unlimited test documents on all plans, and says they do not count against monthly plan limits. That makes test mode suitable for repeated layout previews, with the output limitations described above.
  • Production checks: Render outside test mode when you need the final unwatermarked PDF or need to validate full Excel output and hosted-document availability.
  • Request reliability: Use a finite client timeout, check the HTTP status, and preserve the response body for diagnosing API errors. Treat a failed response as an error rather than writing it as a PDF.
  • Cost: The documentation says test documents do not count against plan limits. It does not provide a price in the reviewed material, so check DocRaptor’s current plan details for production pricing.

FAQ

Can I change the text of DocRaptor’s automatic test watermark?

The reviewed API reference and test-document documentation do not describe an option to customize it. A custom watermark is separate document content and does not replace the automatic mark in test mode.

Does a test PDF count toward my monthly document limit?

No. DocRaptor says test documents are unlimited on all plans and do not count against monthly limits.

Is omitting test enough to avoid the watermark?

Yes. The API reference marks test optional and lists false as its default. Explicitly setting false can make the intended production behavior clearer in code.