[Ultimate PDF] How to generate PDF for non anonymous web screens ?

Forge Component
(14)
Published on 23 May by Leonardo Fernandes
14 votes
Published on 23 May by Leonardo Fernandes

Hi Leonardo,

Is it somehow possible to generate pdf for web screens that require authentication? i.e that are not marked as anonymous?

Report Manager and project web screens are all located in the same domain.

Thanks in advance,

Sérgio Silva


Hi Sérgio. It will be possible to do that, on a future release.

For now, you can work around that by creating a short-lived token before the call to PrintPDF, commit the transaction, then pass this token into your web screen. The web screen should validate the token against the database, and reject if it doesn't find it (or if it is expired).

I'll let you know when I release that feature.

Hi Sérgio. The latest version has support for rendering a non-anonymous web screen to PDF, if you use the ScreenToPDF web block. You can download the demo and open it in Service Studio to see how to use it (the demo has an anonymous screen, but it works just the same with non-anonymous ones).

I will spend a couple days/weeks writing documentation for this component. So if something is not clear or easy to use, please let me know, that will help me a lot.

leonardo.fernandes wrote:

Hi Sérgio. The latest version has support for rendering a non-anonymous web screen to PDF, if you use the ScreenToPDF web block. You can download the demo and open it in Service Studio to see how to use it (the demo has an anonymous screen, but it works just the same with non-anonymous ones).

I will spend a couple days/weeks writing documentation for this component. So if something is not clear or easy to use, please let me know, that will help me a lot.

Hi Leonardo,

Where should I got to download the demo?  I thought I have checked everywhere, but clearly I am missing something as I cannot find it.

Thank you in advance,


trav


Hi Travis,

You can check it here:

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Travis,

You can check it here:

Regards,

Marcelo

Thank you Marcelo,

I have never noticed that option before.  I have only installed apps from Service Studio and it appears the multiple options isn't supported yet.

Thank you again!

trav


Does it work for non-anonymous web screen in a timer? The action inside the timer is using the PrintToPDF_Advanced component. All I get is a pdf of the login screen. I can't seem to download the demo. I am on version 10. Is there a version 10 demo?


My scenario is to generate a bunch of pdfs and save them to the database. Then email them out.

Hi Mark. The timer doesn't have a session, so non-annonymous screens are of course rejected in that context.


For this scenario, the workaround I've given above still applies:

Create a short-lived token before the call to PrintPDF, commit the transaction, then pass this token into your web screen. The web screen should validate the token against the database, and reject if it doesn't find it (or if it is expired).

leonardo.fernandes wrote:

Hi Mark. The timer doesn't have a session, so non-annonymous screens are of course rejected in that context.


For this scenario, the workaround I've given above still applies:

Create a short-lived token before the call to PrintPDF, commit the transaction, then pass this token into your web screen. The web screen should validate the token against the database, and reject if it doesn't find it (or if it is expired).


I got it working. Thanks Leonardo.

Thanks for this - I've tested it and now have it working on a non-anonymous web screen, but it still requires the "registered" role. I have a user role specific to my application, can I check for that instead of just "Registered"?

Leonardo Fernandes wrote:

Hi Sérgio. It will be possible to do that, on a future release.

For now, you can work around that by creating a short-lived token before the call to PrintPDF, commit the transaction, then pass this token into your web screen. The web screen should validate the token against the database, and reject if it doesn't find it (or if it is expired).

I'll let you know when I release that feature.

Hi Leonardo,

Is there some fix available for converting into pdf non-anonymous page using Timer,Or shall we still follow your work around.

Thanks,

Varun.


Mark Jurkovich wrote:

leonardo.fernandes wrote:

Hi Mark. The timer doesn't have a session, so non-annonymous screens are of course rejected in that context.


For this scenario, the workaround I've given above still applies:

Create a short-lived token before the call to PrintPDF, commit the transaction, then pass this token into your web screen. The web screen should validate the token against the database, and reject if it doesn't find it (or if it is expired).


I got it working. Thanks Leonardo.

 Hi Mark,

I am new to Outsystems platform. Can you please guide me how exactly you have done it in Outsystems?

I need to generate PDF (from specific div of the html) using Timer.

 

Leonardo Fernandes wrote:

Hi Sérgio. The latest version has support for rendering a non-anonymous web screen to PDF, if you use the ScreenToPDF web block. You can download the demo and open it in Service Studio to see how to use it (the demo has an anonymous screen, but it works just the same with non-anonymous ones).

I will spend a couple days/weeks writing documentation for this component. So if something is not clear or easy to use, please let me know, that will help me a lot.

 Hi Leonardo,


I tried what u said but it's not working correctly. what i got that is like when i use ScreenToPDF and place our desired data on Content WebBlock that doesn't print in the PDF file PDF file should be download / Open Blank Page. something is wrong in web block. can u check that once again? and also it doesn't support for non-anonymous user. please check and let us know. 

Waiting for replay.

Thanks,

Jay