In this video, we will see how to convert images to PDF using PDF.co Web API.

So, first of all, let us dive into the program, or here we are having the Node JS program which is basically having the two PDF or two images and we are converting the PDF.

PDF to Image

If we go step by step, first of all, we are defining the authentic keys which will go into the headers of the API call.

Then we are having two image source files. Let us see what is inside this so one image is PNG and one is the JPEG.

So here it’s a PNG file and it’s a JPEG.

PDF to Image Conversion    Convert PDF to Image

So basically we’re trying to combine these two images and generate one PDF.  We have provided a destination path and here it is the URL of the API. So the URL is like “PDF convert from the image” and we are passing the name of the destination file. Then we are passing the URLs in the comma-separated format. And then we are providing the request info like the host information. Then we are passing the varied path in the path parameter and then we are providing the API key into ex API key headers.

PDF to Image Tutorial

Upon getting the request we will get JSON in the output.

So, basically, if that all goes well, we will get into the destination file. Otherwise, it will show the log. So here I put the ‘log output’.

PDF to Image Convert Tutorial

Now we’re all set to go. I am firing at the terminal and opening, executing the program. Now we got the output in the URL.

Convert PDF to JPEG

It says it has a two-page count. All goes well. It has a score of 200 and the name is .PDF. And the mark trade is remaining. When we explore the API key, we can see the output.

Extract PDF to Image

So these are the two images we sent as input and we got the output in the PDF format. So, it’s that easy to convert from the images to PDF. And if we want to see more into this API, we can actually go into the documentation and explore the different options.

So I have already opened up this API documentation which is at apidocs.pdf.co. Here is the URL endpoint which we have used https://api.pdf.co/v1/pdf/convert/from/image.

These are different file parameters. If we pass the actual file instead of the URLs, we can also utilize the async option.

PDF to Image Data Extraction

After the output is done. you can check the job info whether it is completed or not. And in the job output, it will have the actual URL of the file. We can download it and get that result.

 

GET YOUR API KEY Zapier plugin  Explore API Docs

 

Check this PDF.co video tutorial using PDF.co Web API and follow us on YouTube!

PDF.co video tutorial

 

PDF.co REST Web API tutorials

Related Pages: