
Automate Factur-X and ZUGFeRD e-Invoices in Python with PDF.co
15 MIN READ
3 MIN READ
Use PDF.co and Make to render PDF pages as WebP images for document previews. Previews may reduce transferred bytes, but compare the actual outputs at a readable resolution before deciding whether they save bandwidth. The images do not retain the PDF’s selectable text or interactive features.
This example converts a two-page PDF into two WebP files. You can download the sample PDF to follow along.
To get started, let’s create a Scenario and choose the PDF.co Make an API Call module.
In the API Endpoint Path field, enter the /pdf/convert/to/webp endpoint. You can learn more about the endpoint at the API Documentation.
In the Input Type field, let’s select the Override URL param with the value option. This will allow us to manually enter the sample file link. Then, enter the file link in the Url field. Here is the link to the sample file.
In Forcely enable async mode, select No, rely on the async param in the Body. For this synchronous test, add async to the request body with the value false.
File size alone does not determine processing time. If synchronous processing times out, use supported asynchronous processing and wait for the job to report success before retrieving the output.
Now, let’s Run the Scenario.
In the demonstrated example, the 329 KB PDF produced two WebP images of approximately 62 KB and 69 KB—131 KB combined. These are sample results, not a general compression ratio.
Compare both images with the original pages. Check small text, images and total file size before choosing your preview settings. Retain the original PDF when users need selectable text, links or interactive fields.
You have converted PDF pages into WebP previews using PDF.co and Make. Compare readability and combined output size for your own documents before deciding whether previews reduce transferred data.
Create an account, get an API key and test a request.