I am using the Ultimate PDF library to generate a PDF. After checking the logs, we found that it takes around 15 seconds to generate the file.
Is there any way to make the PDF generation faster?
Hi @sahatsawat kthasattapich ,
PDF Generation with Ultimate PDF in Outsystems mainly depends on how complex the HTML is that's being converted int the PDF. If the page includes heavy CSS, large images, external resources, or complex layouts it can naturally take more time to generate the file.
To improve the performance, try keeping the HTML and CSS as simple as possible, compressing or optimizing images and remove unnecessary scripts or fonts. It also helps to create a lightweight screen or block specifically for PDF generation and make sure that any heavy data processing is completed before triggering the PDF generation.
Additionally, make sure that any heavy data processing or calculations are completed before triggering the PDF generation. Avoid loading external resources during rendering, minimize nested UI elements, and reuse static content whenever possible. If the PDF is large or complex, you may also consider generating it asynchronously, so it does not impact the user experience.
Thank you for the response. Our HTML and CSS are not very complex since the PDF is mainly a standard document form layout. However, we are wondering whether calling Aggregates inside the Block might affect performance. Would it be considered best practice to pass the data as an Object through the Input parameters instead? From our debugging, it appears that most of the delay is occurring at the PrintToPDF Server Action, which takes around 10 seconds to complete.