Integration-PDF API – Fast and Affordable Document Generation-pdf-to-png

PDF to PNG

Convert each page of a PDF into high-resolution PNG images – perfect for previews, thumbnails, or image-based processing.


Reponse Type

Make sure that the response type is set to PNG.

CustomJS Code

const { PDF2PNG } = require('./utils');

const pdfInput = input.file || input.url;

return PDF2PNG(pdfInput, input.pageRange);

Execution via API request

Option 1: Passing the PDF as a URL

This example shows how to convert the first page of a PDF to a PNG image from a given URL:

curl -X POST https://e.customjs.io/zeXXXy \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY_HERE" \
  -d '{
    "url": "https://css4.pub/2017/newsletter/drylab.pdf"
  }' --output test-by-url.png

Option 2: Passing the PDF as a base64 encoded string

This example shows how to convert the first page of your PDF by sending a Base64-encoded binary string. Keep in mind that the payload size is limited to 6 MB.

curl -X POST https://e.customjs.io/zeXXXy \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY_HERE" \
  -d '{
    "file": "JVBERi0x..........EyNzg3CiUlRU9GCg=="
  }' --output test-by-string.png