In the previous webinar, you have seen how to convert images into PDF. So this is a reverse of it. Here we are going to see how to convert the PDF into images using PDF to image API.

So here we’re going to see how to do tests asynchronously. I have explained a little regarding the async option, in the last video, and we are going to see it in practice here. As usual, first of all, we are having the authentication keys. We are going to declare that and which will be utilized in the headers. We have the source file here.

PDF to Image API

Let’s see what’s inside. We have two PDF pages. We can specify the page numbers here, for example, which are the page numbers we want to convert to images, for example, 0 1? We can row in the comma-separated format. Or if we want to have the range – we can give 2-5, or if we want to have all the pages after a certain page number – we can do like “all the pages after the 7”.

If the PDF is encrypted, we can pull out the password. Make sure you provide the async option to true. So, upon providing the async option, we will have a different response. In the synchronous option, we directly get the output. It takes time to execute. But we get the output straight away. But in the async option, we will get the job as output and we have to check that job periodically.

PDF to Image API Webinar

We have the web client, we have declared the replied to object. We have provided headers into these. We are preparing the URL for PDF to JPEG. So we want to output in JPEG images. So unities and URLs will be converted from PDF to JPEG.

We provide the password and the pages. We provide the URL and enable the async option. So after this is done, the response string will be downloaded. We are going to parse into JSON. We are using Newton’s opt for this and if this, all success, then we are getting the job ID.

We are going to check the result of this job in the row while loop. We are going into the infinite loop.

PDF to Image API Webinar

So you can see we are filing another API like, which basically just status of the job. And we are providing the job ID here. Obviously, we are passing the API keys into headers. They’re getting their response and they’re passing the response into JSON. We are fetching the status and returning it. We are passing the JSON URLs.

So once that’s ready, we are going to download this. Once the job is completed, we will see its output. Let’s see what’s inside. We are having the expected output file.

We’re going to download this file and we’re going to grab the response and we can see it is containing the two image URLs. Because the page, PDF itself is having two pages. So we’re getting the all pages URL and we are getting the one by one URL image by simply downloading these.

PDF to Image API Tutorial

So it’s that easy to convert the PDF into images. If you want to get to know more about this API, you can always go to the documentation and find out the path.



GET YOUR API KEY Zapier plugin  Explore API Docs


Check this video tutorial using Web API and follow us on YouTube! video tutorial REST Web API tutorials

Related Pages: