Why use PDF to JPG API?
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.
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.
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.
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 0 (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/check : true 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.
Now let’s see this program in action.
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)