[Html2PdfConverter] Page is empty when using filtered data

Forge Component
(59)
Published on 17 May (7 days ago) by Guilherme Pereira
59 votes
Published on 17 May (7 days ago) by Guilherme Pereira

Hi, I'm trying to use the component to generate a pdf, but the page is consists of tables and expression, each time it doesn't print the expression or any data that's filtered, what's wrong here and how can i fix it?

Hi Abeer,

Remember that the page you are trying to convert will be called by the executable at the server, not your application so it will be called under a different session anonymously. 

This means that you can't filter using Session variables for example, as they will be empty.
The same thing related to the GetUserId() function, as it will return 0 once there is no user logged in the session the page is attached to.

Check your code to see if your expression and filters are using session variables, GetUserId(), etc.

Cheers.

Eduardo Jauch wrote:

Hi Abeer,

Remember that the page you are trying to convert will be called by the executable at the server, not your application so it will be called under a different session anonymously. 

This means that you can't filter using Session variables for example, as they will be empty.
The same thing related to the GetUserId() function, as it will return 0 once there is no user logged in the session the page is attached to.

Check your code to see if your expression and filters are using session variables, GetUserId(), etc.

Cheers.


Hi Eduardo , thanks for your reply. no the page doesn't use session variable is uses local variable, but for an example it doesn't print it or any other table when i applu filters, i'm using this function to get the URL | 

SyntaxEditor Code Snippet

GetBookmarkableURL()

is it right? i guess each time it access it, it access the page as new screen not as it is while i'm applying filters, any solution for that?

Solution

Hi,

Yes, every time you call the converter, it will call the page as a new page. It's a different "instance" of the page. So, nothing you do when navigating it will persist.

You need to pass those filters through input parameters in the link to the Converter, or you put them in database temporarily and load them from the page, etc. There are some different possibilities here.

You can create an URL with parameters and values pairs using GetEntryURL action from the HTTPRequesHandler module.

Cheers.

Solution

Eduardo Jauch wrote:

Hi,

Yes, every time you call the converter, it will call the page as a new page. It's a different "instance" of the page. So, nothing you do when navigating it will persist.

You need to pass those filters through input parameters in the link to the Converter, or you put them in database temporarily and load them from the page, etc. There are some different possibilities here.

You can create an URL with parameters and values pairs using GetEntryURL action from the HTTPRequesHandler module.

Cheers.

Hi, thanks again for helping.

I got what you mean, I'm trying to implement it as shown in the pic, is it how it is supposed to be as it keeps giving me errors, I have Var1 I need to change it's value so i'm getting it again.



Hi, not sure I understood.

Are you getting an error doing like you did?
What error?

Cheers.

Eduardo Jauch wrote:

Hi, not sure I understood.

Are you getting an error doing like you did?
What error?

Cheers.


Hi thanks I find it out, it needed to put the url correctly, I used as you suggested. before I put the space name.

SyntaxEditor Code Snippet

+ GetEntryURL("Entry1", GetEntryEspaceName() ,"Var1",Var1)

Ah! Nice :)