[Ultimate PDF] Using ScreenshotToPNG twice in combination with Timer = time-out
Forge component by Leonardo Fernandes
Application Type
Traditional Web

We've been using UltimatePdf for some image-heavy PDFs, ~25MB on average total size. We use ScreenshotToPNG for some post-processing of certain images.

Because we have to generate different variants of the same PDF at the same time, we converted to using Timers (one timer for each variant) so they can be generated at the same time.

Unfortunately we receive a time-out for only one timer after ScreenshotToPNG tries for about 112 seconds. This is the only generate action that uses the ScreenshotToPNG action twice in a row, in certain cases. In case the generate action only needs one screenshot action, it works is fine. Also, when we trigger our generate action manually via a button instead of a timer, everything renders and converts fine.

The viewport width and height passed is always below 1800, and the resulting binary does not exceed 300KB. So no extreme rendering in this aspect.

I suspect some memory issue and/or browser sessions that conflict with each other. But I cannot explain why it works in the manual way without using a timer then.

Did anyone encounter this issue or has tips to solve this?


Hi Geertjan,

Please have a look on this post [Ultimate PDF] How to generate PDF for non anonymous web screens ? | OutSystems , it seems there is a workaround/discussion with regards to the timer approach.

Hope this helps,

Thank you and kind regards,

Chris

Thank you for your reply.

The problem is not user or session related because other pdfs actually render fine, those in which the ScreenshotToPdf action is not used twice. We already pass a token to be checked when generating.

We use the screenshot functionality for just one or two pages in a 40+ page pdf. Without this particular page, it generates in around 30 seconds. Including this action (twice) results in a time-out of 2 minutes. Mind you, this only occurs when generating via a timer.

With some additional testing we think the long generation time is not related to the ScreenshotToPNG function per se. 

The difference between triggering the server action via a button (user action) OR via a timer (system action) is huge: 60 secs vs 130+ secs. 

My suspicion of a memory issue or any other resource allocation stays. Maybe a system triggered action has a different way of managing system resources. I couldn't find any Outsystems documentation on this.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.