PDF to Image#
PDF to high quality image conversion. High quality rendering. Also works great for thumbnail generation and previews.
Available Methods#
/pdf/convert/to/webp#
Converts to WEBP
image format.
WEBP
is an image format invented by Google and is supported by Google Chrome and other modern browsers. It provides good quality with smaller file sizes.
Method: POST
Endpoint: /v1/pdf/convert/to/webp
/pdf/convert/to/tiff#
Converts to TIFF
image format.
Method: POST
Endpoint: /v1/pdf/convert/to/tiff
Attributes#
Note
Attributes are case-sensitive and should be inside JSON for POST request, for example:
{
"url": "https://example.com/file1.pdf"
}
Attribute |
Description |
Required |
---|---|---|
|
URL to the source file. 1 |
yes |
|
HTTP auth user name if required to access source |
no |
|
HTTP auth password if required to access source |
no |
|
Comma-separated indices of pages (or page ranges) that you want to use. The first-page index is always 0. For example, if you have a 7-page document that you want to be split into 3 separate PDFs but a different number of pages it would go like this: 0, 1, 2- or 1, 2, 3-7 which will result in 1 PDF with page one, 1 PDF with page two and one PDF with the rest of the pages. You can also use inverted page numbers adding |
no |
|
Defines coordinates for extraction, e.g. |
no |
|
Set to |
no |
|
Password of PDF file, the input must be in string format. |
no |
|
Set |
no |
|
File name for the generated output, the input must be in string format. |
no |
|
Set the expiration time for the output link in minutes (default is |
no |
|
Use this parameter to set additional configurations for fine-tuning and extra options. Explore the Profiles section for more. For example, to turn On/Off layers for rendering:
Or you can control
|
no |
Query parameters#
No query parameters accepted.
Payload#
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-image/sample.pdf",
"inline": true,
"pages": "0-",
"async": false
}
Response 2#
{
"urls": [
"https://pdf-temp-files.s3.amazonaws.com/c15b8d82e0034d01a73eac719d69349b/sample.png",
"https://pdf-temp-files.s3.amazonaws.com/152d2fe414b645e38f81a49e5dafa85b/sample.png"
],
"pageCount": 2,
"error": false,
"status": 200,
"name": "sample.png",
"duration": 1121,
"remainingCredits": 98722216,
"credits": 30
}
CURL#
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/to/png' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-to-image/sample.pdf",
"inline": true,
"pages": "0-",
"async": false
}'
Code samples#
Footnotes
- 1
Supports links from Google Drive, Dropbox, and PDF.co Built-In Files Storage. To upload files via the API check out the File Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add
cache:
to enable built-in URL caching. (e.gcache:https://example.com/file1.pdf
) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.- 2
Main response codes as follows:
Code
Description
200
Success
400
Bad request. Typically happens because of bad input parameters, or because the input URLs can’t be reached, possibly due to access restrictions like needing a login or password.
401
Unauthorized
402
Not enough credits
445
Timeout error. To process large documents or files please use asynchronous mode (set the
async
parameter totrue
) and then check status using the /job/check endpoint. If a file contains many pages then specify a page range using thepages
parameter. The number of pages of the document can be obtained using the /pdf/info endpoint.Note
For more see the complete list of available response codes.