Why use PDF to JPG API?

Extract PDF to JPG
Convert multiple-page PDF to JPG

Using our PDF to JPG API you can convert your PDF Files into JPG fast and easily. You can convert multiple paged PDFs into multiple JPG’s as well.

Web API Automation Platforms Integrations

PDF.co API platform supports multiple programming languages that programmers can use: PHP, Javascript, Java, C#, .NET and ASP.NET, Visual Basic, and others.


If you’re not a programmer, you can use PDF.co through automation platforms such as:

On-Prem Version for Enterprise

PDF.co platform operates on secure and certified cloud infrastructure. We also have an on-premise version that works on your server and can even run completely offline when required for enterprise customers who process sensitive data.


PDF to JPG API Sample & Demo

For this demo, I am going to use a Sample PDF File.

Source PDF
Source File

The code snippets used below can be written in different programming languages. The Web API engine adds text to our sample PDF file. The final result will look like this.

Output JPG
Output JPG
Output JPG
Output JPG

Before we proceed with the code, let us first check the /v1/pdf/convert/to/jpg parameters and its uses.


URL: https://api.pdf.co/v1/pdf/convert/to/jpg
Method: POST
Parameter Description
url required. Link to the source file.
pages optional. Comma-separated list of page indices (or ranges) to process. IMPORTANT: the very first page starts with (zero). To set a range use the dash , for example: 0, 2-5, 7-.
rect optional. Defines coordinates for extraction, e.g. 51.8, 114.8, 235.5, 204.0. Must be a string.
encrypt optional. Enable encryption for the output file: true or false
async optional. Runs processing asynchronously. Returns jobId to use with job/checktrue or false
name optional. Output file name.
profiles optional. Must be a String. Set custom configuration. See profiles examples here


Now we are ready to write some codes.

cURL Code Snippet

curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/to/jpg' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-image/sample.pdf",
  "pages": "0-"

This sample code and other cURL source code samples are available here.


Now let’s see this program in action.

Output JPG using cURL
Output JPG using cURL

Source code samples in JavaScript are available here.

Source code samples in Java are available here.

Source code samples in C# are available here.

Source code samples in PHP are available here.


NOTE: Use PDF.co Document Classifier to know the source of the document. You can easily create and maintain classification rules with the desktop-based Classifier Testing Tool (see the details here)

Related Pages:

Related Samples: