Skip to content
ComPDF
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

PDF to Image API

Feature

Request Mode

ItemValue
Authenticationx-api-key: your_api_key_here
Request URLPOST http://localhost:8080/api/v1/process/pdf/png
Content typemultipart/form-data
Success responsePNG or image archive file stream

Request Parameters

ParameterTypeDescriptionRequired
fileFileSource file. Recommended extension: .pdf.Yes
optionsStringJSON string containing the feature options below.No
passwordStringSource file open password, used for password-protected PDFs.No

Options Parameters

Put the following fields in the options JSON string.

ParameterTypePurpose
imageFormatStringImage output format. Supported values include JPG, JPEG, JPEG2000, PNG, BMP, TIFF, TGA, GIF, WEBP. The ComPDF Self-hosted uppercases this value before forwarding.
imageScalingNumberImage scaling ratio for PDF to image. The ComPDF Web calculates this from DPI as DPI / 72.
pageRangesStringPage ranges to process, starting from page 1. Examples: 1, 1-3, 1,3-5. Empty means all pages.
outputFileNameStringOptional output filename. When present, it is used as the preferred download filename.

Request Example

bash
curl -X POST "http://localhost:8080/api/v1/process/pdf/png" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'options={"imageFormat":"PNG","imageScaling":2,"pageRanges":""}'

Response

On success, the API returns the converted file stream with Content-Type and Content-Disposition headers. On failure, the ComPDF Self-hosted returns a normalized error JSON response.