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.

PNG/Image to PDF API

Convert an image file to PDF.

Feature

Request Mode

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

Request Parameters

ParameterTypeDescriptionRequired
fileFileSource file. Recommended extension: .png,.jpg,.jpeg,.bmp.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
sourceTypeString or IntegerSource type flag for non-PDF to PDF conversion. The ComPDF Web sends 1.
enableOcrInteger or StringWhether to use OCR. 0 = disabled, 1 = enabled.
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/png/pdf" \
  -H "x-api-key: your_api_key_here" \
  -F "[email protected]" \
  -F 'options={"sourceType":"1","enableOcr":0}'

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.