[Html2PdfConverter] Passing logged in role information to another screen

Hi All,


I'm currently making use of Html2PdfConverter to print my table results in a PDF. To print the results in a PDF, I have created a new screen for it. This screen has been set accessible by "Anonymous", since this component requires it to be so, to avoid 401 Unauthorized error.

However, I have a check for the PDF screen, where the system will check if the user is of a certain role, in order to access the PDF screen. If the user is not of a certain role, they should not be able to access this PDF screen. The user will be directed to "Invalid Permissions" page. However, because of this check, my downloaded PDF cannot be viewed successfully.

I've tried to use session variable to pass user HasAccess information, but it still does not work.


Thanks in advance for suggestions or help given!

Html2PdfConverter called the page from an executable on the server and isn't in the users session so it has no user information and no session information. You will need to pass the details as parameters on the page call, ie userid and tenantid.


Because this can be a security issue you may want to consider inserting the user details into a table and then pass a key to the page that it uses to lookup the details from that table and delete the record when your finished.


Once you have the userid you can then use the internal function to switch tenant and login as the user.

For example in the Preperation of your page put something like this

Where CheckToken is doing the database lookup and returning the user ID