How to Add a Screenshot to a PDF Using the PDF.co API
This tutorial shows how to place a screenshot or another image onto an existing PDF using PDF.co’s PDF Add endpoint and the online API Tester.
What You Will Need
- A PDF.co account and API key
- A source PDF
- A JPG or PNG screenshot
- Publicly accessible URLs for both files
If either file is stored locally, upload it to PDF.co File Storage and use the generated filetoken:// link.
Step 1: Determine the Image Position
Open the source PDF in the PDF.co PDF Inspector.
Use the tool to determine:
- The X coordinate
- The Y coordinate
- The image width
- The image height
- The page on which the screenshot should appear
Coordinates are measured from the upper-left corner of the page. Page numbering starts at 0, so 0 represents the first page.
Step 2: Open the API Tester
Open the PDF.co API Tester and select the PDF Add endpoint:
POST /v1/pdf/edit/add
Enter your PDF.co API key when requested.
Step 3: Configure the Request
Use the following JSON as the request body:
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/sample.pdf",
"name": "pdf-with-screenshot.pdf",
"async": false,
"images": [
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/logo.png",
"x": 270,
"y": 150,
"width": 159,
"height": 43,
"pages": "0"
}
]
}Replace the sample URLs and placement values:
- url: The source PDF URL or
filetoken://link. - name: The desired output filename.
- images.url: The screenshot URL or
filetoken://link. - x and y: The image position.
- width and height: The image dimensions.
- pages: The pages that should receive the image.
Use 0- to place the screenshot on every page. Multiple images can be added by including additional objects in the images array.
For all supported parameters, see the PDF Add API documentation.
Step 4: Run the Request
Run the request in the API Tester.
A successful response contains a temporary URL for the updated PDF. Open that URL and confirm that the screenshot appears on the correct page, at the intended position and size.
Conclusion
You have added a screenshot to an existing PDF using the PDF.co PDF Add endpoint. The same request can be adapted to add multiple images, place images on several pages, or make an image clickable by including a link value in the image object.
Related Tutorials

