PDF to Image HTTP API
Overview
Send a PDF file, its binary data, or its URL to render pages as images. Select page ranges and configure resolution and cropping in the PDF to Image HTTP API reference. See HTTP Response for single-image and ZIP output.
Quick Start
The examples below cover the basic conversion flow. See additional examples for more scenarios.
For a multi-page PDF, the API returns a ZIP archive containing an image for
each page. For a single-page PDF, the output is directly an image (e.g., PNG).
To determine the output format, check the Content-Type response header.
You can enforce the use of a ZIP archive by using force_zip.
HTTP Request
All conversion API requests are sent as POST requests to the conversion endpoint. This section covers the technical details, including endpoint URLs, authentication methods, parameter format, and request structure.
Endpoint
https://api.pdfcrowd.com/convert/24.04/
Older endpoints:
-
https://api.pdfcrowd.com/convert/20.10/for API version 20.10 -
https://api.pdfcrowd.com/convert/18.10/for API version 18.10 -
https://api.pdfcrowd.com/convert/latest/deprecated
Learn more about API versioning.
Authentication
The API uses HTTP Basic authentication. Use your PDFCrowd username as the username and your API key as the password.
To get started quickly, you can use these demo credentials for testing:
-
Username:
demo -
API key:
demo
Use your own PDFCrowd username and API key for production. You can obtain API credentials from a free trial or API license.
Include the Authorization header in your request:
Authorization: Basic <credentials>
where <credentials> is the Base64 encoding of your username
and API key joined by a colon (username:apikey).
POST Parameters
Conversion settings and options are sent as parameters in the POST request body to configure the conversion. For a complete list of available parameters and their descriptions, see the Parameter Reference.
URL Parameters
The following optional parameter can be appended to the endpoint URL:
-
errfmt– Specifies the error response format (see HTTP Response)-
txt– Returns errors in plain text format (default) -
json– Returns errors in JSON format
-
Example:
https://api.pdfcrowd.com/convert/24.04/?errfmt=json
Request Format
The Content-Type header must match the request body format.
Most HTTP libraries and tools set this automatically based on how you structure your request.
-
multipart/form-data– Required when uploading local files -
application/x-www-form-urlencoded– May be used when no files are uploaded
Note: If you are using a standard HTTP client library or tool, the Content-Type is typically set automatically. You only need to set this manually when working with low-level HTTP libraries.
HTTP Response
The API returns different responses based on the conversion outcome. This section explains HTTP status codes, response body formats for both successful conversions and errors, and response headers containing conversion metadata.
Success Response
HTTP Status: 200 OK
The converted file is returned in the response body.
The Content-Type header is set to the appropriate MIME type for the output format.
One rendered page returns a single image. Multiple rendered pages return a
ZIP containing one image per page. Set
force_zip
to true to receive a ZIP even for one page.
Error Response
HTTP Status: 4xx (client error)
Error details are returned in the response body.
The format is controlled by the errfmt URL parameter
(see HTTP Request).
Text Format (errfmt=txt, default)
Content-Type: text/plain
<status_code>.<reason_code> - <message>
JSON Format (errfmt=json)
Content-Type: application/json
{
"status_code": <http_status_code>,
"reason_code": <specific_error_code>,
"message": "<error_message>"
}
For a complete list of status codes and reason codes, see API Status Codes.
Response Headers
The HTTP response includes the following headers with additional information about the conversion:
| Name | Description |
|---|---|
x-pdfcrowd-debug-log
|
URL pointing to the debug log for this request. |
x-pdfcrowd-remaining-credits
|
Number of conversion credits remaining in your account. |
x-pdfcrowd-consumed-credits
|
Number of credits consumed for this conversion. |
x-pdfcrowd-job-id
|
Unique identifier assigned to this conversion job. |
x-pdfcrowd-output-size
|
Size of the output data in bytes. |
x-pdfcrowd-reason-code
|
The error reason code, or 0 if no error. |
Troubleshooting
- If you are receiving an error, refer to the API Status Codes for more information.
- Use debug_log to obtain detailed information about the conversion process, including load errors, load times, browser console output, etc.
- Consult the FAQ for answers to common questions.
- Contact us if you need assistance or if there is a feature you are missing.