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.
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.
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.
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’.
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.
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.
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.
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.
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
- Introduction to PDF.co Web API
- How to Convert Images to PDF
- How to Convert PDF to Image
- How to Find PDF Information
- How to Make PDF Searchable
- How to Merge PDF using API
- How to Split PDF into Pages
- How to Search PDF for Text
- Add Image to Existing PDF
- Add Text to Existing PDF
- How to Convert PDF to Text
- How to Convert PDF to JSON
- How to Convert PDF to XML
- How to Convert PDF to HTML
- How to Generate BarCodes
- How to Read BarCodes