
Automate Factur-X and ZUGFeRD e-Invoices in Python with PDF.co
15 MIN READ
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.
If either file is stored locally, upload it to PDF.co File Storage and use the generated filetoken:// link.
Open the source PDF in the PDF.co PDF Inspector.
Use the tool to determine:
Coordinates are measured from the upper-left corner of the page. Page numbering starts at 0, so 0 represents the first page.
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.
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:
filetoken:// link.filetoken:// link.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.
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.
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.
Create an account, get an API key and test a request.