ScreenshotNeo

BlogHow-to

Generate Images Instead of PDFs

Use PDFMonkey image templates to generate WebP, PNG, or JPG files with custom dimensions, transparency, quality, filenames, and webhooks.

By the ScreenshotNeo team1 October 20267 min read

Yes. PDFMonkey can generate images instead of PDFs. Create a template with the Image output type, then send the same document-generation request to /api/v1/documents using that template ID. Image templates can produce WebP, PNG, or JPG files, with configurable pixel dimensions, transparency, WebP quality, and filenames.

How PDFMonkey image generation works

The API workflow is almost the same as PDF generation:

  1. Create a template and choose Image as its output type. You can also duplicate an existing template and change its output type.
  2. Set the template dimensions in pixels. The documented default is 500 × 500 pixels.
  3. Enable a transparent background if your design needs one. Transparency works with WebP and PNG; JPG fills transparent areas with white.
  4. Submit a normal document-generation request to /api/v1/documents, setting document_template_id to the image template ID.
  5. Use the generated file URL or completion webhook in your application.

The default image format is WebP. You can override output settings per request through the meta object.

Template setup

1. Create an image template

In PDFMonkey, create a new template and select Image for the output type. If you already have a PDF template, duplicate it and switch the duplicate to Image. Review the layout after switching: PDFs are paginated documents, while images are single pixel-based canvases.

2. Choose dimensions

Set width and height in pixels. The default is 500 × 500. For a social card or Open Graph image, PDFMonkey identifies 1200 × 630 pixels as a widely recommended size. Keep dimensions reasonable: images above 4000 × 4000 pixels take more time and memory to render, even though there is no hard pixel limit.

3. Configure transparency

Turn on a transparent background for logos, overlays, stickers, and composited graphics. Use WebP or PNG when transparency matters. JPG does not preserve an alpha channel, so transparent areas become white.

Request parameters

Send the template ID in document_template_id. Output overrides belong in meta:

Parameter Values Purpose
_type webp, png, jpg Choose the output format. WebP is the default.
_width Positive integer Override template width in pixels.
_height Positive integer Override template height in pixels.
_quality WebP quality value Control WebP compression quality.
_filename Base filename Set the downloaded file name; PDFMonkey adds the matching extension.

Keep the rest of your document payload the same as your PDF workflow. The exact data fields used by your template still apply; only the output template and optional image metadata change.

cURL example

curl -X POST "https://api.pdfmonkey.io/api/v1/documents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": {
      "document_template_id": "YOUR_IMAGE_TEMPLATE_ID",
      "status": "pending",
      "payload": {
        "title": "Weekly product update",
        "subtitle": "New features shipped this week"
      },
      "meta": {
        "_type": "png",
        "_width": 1200,
        "_height": 630,
        "_filename": "weekly-product-update"
      }
    }
  }'

Replace the template ID, API key, and payload fields with the values your template expects. If your account uses a different authentication header, use the header specified in your PDFMonkey API settings.

Python example

import requests

payload = {
    "document": {
        "document_template_id": "YOUR_IMAGE_TEMPLATE_ID",
        "status": "pending",
        "payload": {
            "title": "Weekly product update",
            "subtitle": "New features shipped this week"
        },
        "meta": {
            "_type": "webp",
            "_width": 1200,
            "_height": 630,
            "_quality": 82,
            "_filename": "weekly-product-update"
        }
    }
}

response = requests.post(
    "https://api.pdfmonkey.io/api/v1/documents",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json=payload,
    timeout=90
)
response.raise_for_status()
print(response.json())

Node.js example

const payload = {
  document: {
    document_template_id: 'YOUR_IMAGE_TEMPLATE_ID',
    status: 'pending',
    payload: {
      title: 'Weekly product update',
      subtitle: 'New features shipped this week'
    },
    meta: {
      _type: 'jpg',
      _width: 1200,
      _height: 630,
      _filename: 'weekly-product-update'
    }
  }
};

const res = await fetch('https://api.pdfmonkey.io/api/v1/documents', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
});

if (!res.ok) {
  throw new Error(`PDFMonkey returned ${res.status}: ${await res.text()}`);
}

console.log(await res.json());

Choosing WebP, PNG, or JPG

Format Use it when Limitations
WebP You want a small file with good visual quality. It is the default and supports transparency. Some older consumers may require a fallback format.
PNG You need lossless output, maximum compatibility, or transparency. Files are often larger than WebP.
JPG You need a broadly supported photo-style image without transparency. Transparent regions render as white and compression is lossy.

Images versus PDFs

Use an image template for social cards, Open Graph previews, logos, watermarks, thumbnails, and overlays. Use a PDF template for paginated documents, print layouts, paper sizes, headers, and footers. PDFMonkey states that PDFs and images have fundamentally different capabilities: image templates use pixel dimensions and can provide transparent backgrounds, while PDFs use paper-oriented layout features.

Switching output types does not automatically make a PDF layout suitable for a single canvas. Recheck fixed widths, overflow, text wrapping, and elements that were positioned relative to a page break.

Webhooks and asynchronous processing

Image generations trigger the same completion events as PDF generations: documents.generation.success and documents.generation.failure. You can therefore keep an existing asynchronous workflow and change only the template and image metadata.

  • Persist the document ID returned by the creation request.
  • Handle success and failure events idempotently, because webhook delivery can be retried by an integration.
  • Store the output format and dimensions with your job record so downstream systems know what to expect.
  • Validate that the received file extension matches _type before publishing it.

Practical design patterns

Social and Open Graph cards

Use a 1200 × 630 canvas, keep important content away from the edges, and prefer PNG when every platform must decode the same lossless pixels. WebP is useful when file size matters and your distribution targets support it.

Transparent logos and overlays

Choose PNG or WebP and enable transparency in the template. Do not select JPG for assets that will be placed over another background.

Many fixed-size variants

Keep one source template and override _width and _height per request when the design remains responsive at those sizes. For substantially different compositions, separate templates are safer than extreme dimension overrides.

Performance, reliability, and cost considerations

  • Dimensions: Larger canvases consume more memory and increase generation time; PDFMonkey specifically cautions about sizes above 4000 × 4000.
  • Format: WebP can reduce transfer size; PNG trades larger files for lossless output and compatibility.
  • Async jobs: Webhooks prevent a request handler from waiting for rendering. Store job state and retry your own webhook processing safely.
  • Retries: Retry transient HTTP or network failures with backoff, but avoid creating duplicate documents unless your workflow has an idempotency strategy.
  • Cost: Rendering cost depends on your PDFMonkey account and plan. The documented image workflow does not add a separate API pattern; check your account’s current pricing before setting volume budgets.

Troubleshooting

Symptom Likely cause Fix
The response is a PDF The request points to a PDF template. Use a template whose output type is Image and pass its ID as document_template_id.
Transparent areas are white JPG was selected. Use PNG or WebP and enable transparency in template settings.
Output is cropped Canvas dimensions do not match the design. Set explicit _width and _height, then inspect overflow and fixed-position elements.
Generation is slow or memory-heavy The canvas is very large. Reduce dimensions; avoid exceeding 4000 × 4000 unless necessary.
Filename has the wrong extension The base name includes an extension or does not match _type. Pass a base name through _filename and let PDFMonkey append the format extension.
Webhook never updates the job The handler ignores image events or is not idempotent. Handle both documents.generation.success and documents.generation.failure for images and PDFs.
Text wraps differently than expected Pixel dimensions changed the available layout width. Test the target dimensions and adjust font sizes, line heights, and container widths.

Or skip the browser setup

If your real task is capturing an existing web page as an image, ScreenshotNeo provides a single HTTP request for PNG, JPEG, WebP, or PDF output. Its capture options include full-page shots, CSS-element capture, custom viewports, retina scale, dark mode, custom CSS and JavaScript, waits, request blocking, headers, cookies, geolocation, resizing, caching, signed links, async jobs, and bulk capture.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' }); const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Before capture, cookie and consent banners, newsletter popups, and chat widgets are removed. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf. See the ScreenshotNeo documentation for request options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

FAQ

Can one PDFMonkey template output both a PDF and an image?

Use separate templates or duplicate the template and choose the required output type for each copy.

Is WebP mandatory for image templates?

No. WebP is the default, but requests can select WebP, PNG, or JPG with _type.

Can I change dimensions for each request?

Yes. Use _width and _height in the request metadata, within practical memory and rendering limits.

Do image jobs need a different webhook endpoint?

No. Image and PDF generations use the same success and failure event names.

What should I use for a transparent social card?

Use WebP or PNG with transparency enabled. JPG cannot preserve transparent pixels.