HTML To PDF Hide Button During Converting

HTML To PDF Hide Button During Converting

  

Hi ,

I have a htmltopdf conversion on my popup report.

the problem is i have a button on that popupscreen called "Download to pdf" 

i want not to show the button and the grey part after converting to pdf.



Thanks,

Tams

Hi Tams,


HTML2PDF does not working fine with SilkUI.  You should create a regular theme, based on London maybe and use this theme for your reports.

The elements you don´t want to have in your screen needs to be hidden. This component just to open a screen and print it into a pdf file. So, the best approach is have a clean screen with only the printable content inside.  This is the page you will send to generate pdf.


Best regards

Fabio Fantato

 

Hi Fabio,

Its a clean screen with printable content inside. Please see below image.

do you have any idea that i can do instead of calling popup screen ?, how can i call that screen and convert html to pdf without using popup and automatically download as pdf in parent screen?


THanks,

Tams


Fábio Fantato wrote:

Hi Tams,


HTML2PDF does not working fine with SilkUI.  You should create a regular theme, based on London maybe and use this theme for your reports.

The elements you don´t want to have in your screen needs to be hidden. This component just to open a screen and print it into a pdf file. So, the best approach is have a clean screen with only the printable content inside.  This is the page you will send to generate pdf.


Best regards

Fabio Fantato

 



Hello Tams,

This is what it is happening in your case when you are working with Html2Pdf

1. You call the PopUp
2. You press the button that will create the PDF.
3. The button calls the logic to create the PDF.
4. The logic is external to your application (it is an executable in the server), so it downloads the URL you sent to him and convert in HTML, returning it.

So, now, for the important aspects.

a) The URL you passed, when called from the Html2Pdf executable, it is in an anonymous session. So, if your page needs to know the logged user that is requesting the PDF, you need to pass the required information to the URL through input parameters. Otherwise, any data you may be trying to fetch that requires, for example, the User Identifier, will be empty.

b) As Fábio stated before, if you are passing the URL of the PopUp itself (and that's ok), you need to guarantee that when you reach the PopUp through the Html2Pdf executable (anonymously), you don't render the elements you don't wanna display. You do this using conditionals (IF) in your screen that shows or not something depending the origin of the request (your session (valid UserId) or anonymously, for example.

Hope this helps.

Cheers.

Hi sir . 

base on your reply. i already passing parameters on it that's why i have a display record while opening the popup screen. but during the converting its not indicated in the pdf file.

During popup screen:

But when i convert it to pdf , this was the output.


THanks,

Tams

Eduardo Jauch wrote:

Hello Tams,

This is what it is happening in your case when you are working with Html2Pdf

1. You call the PopUp
2. You press the button that will create the PDF.
3. The button calls the logic to create the PDF.
4. The logic is external to your application (it is an executable in the server), so it downloads the URL you sent to him and convert in HTML, returning it.

So, now, for the important aspects.

a) The URL you passed, when called from the Html2Pdf executable, it is in an anonymous session. So, if your page needs to know the logged user that is requesting the PDF, you need to pass the required information to the URL through input parameters. Otherwise, any data you may be trying to fetch that requires, for example, the User Identifier, will be empty.

b) As Fábio stated before, if you are passing the URL of the PopUp itself (and that's ok), you need to guarantee that when you reach the PopUp through the Html2Pdf executable (anonymously), you don't render the elements you don't wanna display. You do this using conditionals (IF) in your screen that shows or not something depending the origin of the request (your session (valid UserId) or anonymously, for example.

Hope this helps.

Cheers.



Hi,

It is clearly a "session" problem.

You're using something in the filter of the aggregate that depends on the session, but the page, when called from the HTML2PDF, is not in the same session.

I would say that you're using GetUserId() in your filter...

Could you check it please? It will return 0, as there is no logged user when the page is called anonymously to create the PDF.

Cheers.

Hi,

I'm not usin GetUserId() , all my page set Page anonymously , please see below image for your reference regarding in preperation.



Thanks.

Tams

Eduardo Jauch wrote:

Hi,

It is clearly a "session" problem.

You're using something in the filter of the aggregate that depends on the session, but the page, when called from the HTML2PDF, is not in the same session.

I would say that you're using GetUserId() in your filter...

Could you check it please? It will return 0, as there is no logged user when the page is called anonymously to create the PDF.

Cheers.



Ok,

Something you need is not being correctly passed to the page when you call the action to convert the URL to HTML, as the aggregate is not being able to FIND the data.

If you're not using GetUserId(), must be something else.

I would start by checking if the page is receiving the right input parameters.

After open the Popup, put a breakpoint in its preparation, turn on the debugger, and click the button. You should be able to catch the request in debug and check the input parameters and the results.

This way you eill be able to find what is not being correctly passed to the page when called from the logic to convert to HTML.

Cheers.

By the way, I'm seeing at least two variables in your aggregate: GetIn and ShippingLines.

Be sure you are passing correct values for them when calling the Convert to HTML action.

Basically, you have to build your URL with the parameters you want to send.
You can use the GetEntryURL to construct your URL as it accepts some arguments to create the URL with parameters (you have to pass both the parameter name AND the value.

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/HTTPRequestHandler_API#GetEntryURL

Cheers.

Tams, better yet, use GetBookmarkableURL(), as it will include the input parameters automatically.

https://success.outsystems.com/Documentation/10/Reference/Logic/Built-in_Functions/URL_Built-in_Functions#GetBookmarkableURL

Cheers.

Hi

I made a correct url w/ parameters using getentryurl, but encountered these error: 

'C:\Windows\TEMP\TEMPRHQUVWAMDX00000000000000000000000000000000.pdf'.


THanks,

Tams

What is the error?

Put here the error from Service Center log, please.

Hi , 

PLease see below image.

Thanks,

Tams

Eduardo Jauch wrote:

What is the error?

Put here the error from Service Center log, please.



I would say that the URL you are creating is not working, so the executable is not being able to create the PDF.

Try to use the GetBookmarkableURL instead, as it will get the exactly URL that was used to open the popup...

Cheers.,

Ok, I did a test.

The BookmarkableURL() is not working correctly when used inside a PopUp.

You can uild your URL with the parameters, still.

Pass something like this to the URL parameter:

URLEncode(GetBookmarkableURL() + "?param1=" + Input1 + "&param2=" + Input2)

The URLEnconde is in the HTTPRequestHandler extension.

Replace param1 for your parameters (input parameters).

Cheers.

Hi Sir 

Still facing below error code:

Could not find file 'C:\Windows\TEMP\TEMPXSTUCDHURX00000000000000000000000000000000.pdf'.

using these code:

URLEncode(GetBookmarkableURL() + "?DateFrom=" + DateFrom + "&DateTo=" + DateTo + "&ShippingLines="+ShippingLines)

THanks,

Tams

Solution

Ok, Sorry, I made a mistake.
Use this instead:

GetBookmarkableURL() + "?DateFrom=" + DateFrom + "&DateTo=" + DateTo + "&ShippingLines="+ShippingLines

The URLEncode can't be used in the whole string. Sorry.

Solution

Tams Katigbak wrote:

Hi ,

I have a htmltopdf conversion on my popup report.

the problem is i have a button on that popupscreen called "Download to pdf" 

i want not to show the button and the grey part after converting to pdf.



Thanks,

Tams

Hi Tams,


Can you share this how you to this report?


Thanks