Add Image to Existing PDF - Technical Webinar

In this tutorial, we are going to see how we can add an image into an existing PDF with

Step 1: Select PDF/edit/add API

First of all, let’s see the documentation. So for this, we are having the API named PDF/edit. If you want to add text or image into the existing PDF, we are having the PDF/edit/add which we are going to use. But there are different versions if you want to delete text from PDF, we are having the API endpoint. For example, the delete text if you want to search and replace text within the PDF. But having the replace text if you want to replace a text within an image.

How to Add Image to Existing PDF

Step 2: Set Input and Output Parameters

Let us see these API parameters and responses. So input parameters are universal like the async parameter. If you want to output in the async mode and encrypt parameters – we want the output file encrypted. So here are the width and height parameters. This is the width and height of the input image. These are the coordinates to where we want to add the image or text file. If you want that text or image as a transparent version, we can enable the transparent true color of the text.

This URL image is like the URL of the image file, which we’re going to add. These parameters are for the source PDF. If you want to upload the file, we can utilize these if you want to add a URL to it. We can have the URL if you want to add a text. Then whatever text we want to add, we can add here. The font name, the type, and the pages into which pages we want to add these things. This is the output.

Add Image to Existing PDF

Step 3: Enter API Key and Implement Add Image(s)

Let us see these in action. First of all, we are providing the API keys here. We are providing the source PDF file here. It’s the standard invoice file, which we are having here. We are not providing a list of pages.

It will add to all the pages over the input PDF is not encrypted. We are leaving this password fill blank. We are providing the result file here and now we are adding the image into it. We have a specified type as an image. We have provided the coordinates to where the images need to be added. We have provided the width and height and we have provided the image URL.

How to Add Image to PDF

Step 4: Set Design Parameters such as Size, Coordinate, etc. then Send Request

Let us see what we are adding here. We are adding the logo of the BYTESCOUT here and we are generating the query here. Like the PDF/edit/add and then we are providing the name, we are providing the password. We are providing the pages, URL, type then X, and Y coordinates. We are specifying the width and height and the URL image. When these are done, we are preparing the request option with the host and headers containing the API key.

Then we’re going to send the request. Upon the response, we are passing to JSON and if all goes well, then we are going to download the file. Let us see it in action, fire up the terminal, and execute the program.

Add Image to PDF

The file is generated now. Let’s explore it in Explorer and see the result file. We have successfully added that image to the existing PDF. That’s how easy to manipulate the PDF file, to add the image object into that by using the web API.

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

Video Guide