[Ultimate PDF] Error while using the ultimate pdf for downloading a screen
ultimate-pdf
Reactive icon
Forge component by Leonardo Fernandes
Application Type
Reactive

Hi Team,


I am receiving the below error while integrating the screen to pdf functionality.

ScreenToPDF requires that the ScreenToPDF_OnInitialize action is invoked during the OnInitialize event of the screen 


Sometimes the pdf is downloaded and sometimes it returns the above error.

Does anyone, please help to sort this out?

Could you please tell where you are calling "ScreenToPDF_OnInitialize " action? According to above error it must be call onInitilize() of the screen.

I have called it on the oninitialize().

Sometimes it works fine and pdf downloaded properly and sometimes it returns this error.

Screenshot 2022-04-12 002225.png

Got this same intermittent issue.

Any solution for this issue?

Hi. The latest version (8.0.0) should resolve this intermittent issue.

Hi i m facing the same issue

ScreenToPDF_OnInitialize action must be invoked during the OnInitialize event of the screen

suddenly with latest UltimatePDF version.

Any suggestions?

Our app is a reactive web app

Does that issue happen every time you generate a PDF?


Hi, 

yes, unfortunately it happens every single time after upgrading


Have you checked that the screen has an OnInitialize event, and that the action ScreenToPDF_OnInitialize is called inside of the OnInitialize of the screen? See images below for a reference.


Well that's quite interesting.

Although references where up to date, the name was different OnInitializeScreentoPDF.. I removed the dependency completely, and re introduced it, and became ScreenToPDF_OnInitialize .

Now i can't see in the console log the error, but on the server it is still present, and PDF is corrupted.

On server, the error is the following:

UltimatePDF.OnInitializeMissing: ScreenToPDF_OnInitialize action must be invoked during the OnInitialize event of the screen 

However, if i may point, my setup is as follows..

Screen > Calling 1 Single Block and onInitialize of the block call UltimatePDF. Could it be the reason of the issue? and if so how can we manipulate this since this block is reusable ?





Yes, that is probably the issue. The ScreenToPDF_OnInitialize must be invoked during the OnInitialize of the screen itself. Invoking it on a block is too late to prevent the screen from rendering in the browser.

Moved onInitialize on the screen, and worked ok.

Interesting though, that before upgrading, by calling from inside the block the exact same action, was ok.

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