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 PDF to JPEG format fast and easily. It converts each PDF page to JPEG. And can convert a PDF with multiple pages in one go.

Web API Automation Platforms Integrations

PDF.co platform can convert PDF to JPG from programming languages such as PHP, Javascript, .NET and ASP.NET, C#, Java, Visual Basic, and many others. Find source code samples in our API documentation.

SIGN UP FOR FREE

Business Automation Platforms Integrations

If you are not a developer, you can also easily automate your PDF operations via popular business automation platforms: Zapier, Make, Airtable, Salesforce, Google Apps Script, and 300+ more.

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 their uses.

Endpoint for PDF to JPEG Format

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 to convert PDF to JPG quickly.

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.

SIGN UP FOR FREE

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)