95
Views
12
Comments
Solved
[Html2PdfConverter]  html2pdfConverter - It is possible to download a dynamic page?
Question
html2pdfconverter
Web icon
Forge asset by Guilherme Pereira

Hi, 

With this forge component "Html2PdfConverter " it is possible to download a dynamic page? If so, would anyone have any examples?

I have the following scenario: I need to download a file with information from a detail screen. 

I created the anonymous screen and followed the guidelines of this file:

 https://success.outsystems.com/Documentation/How-to_Guides/Development/How_to_create_reports_using_HTML2PDF

But I don't know how to take the (inputid) of the details screen where I call the action "GeneratePDF" and then take it to the screen aggregate with the information to the download.

Regards, 

Jessica. 


2022-08-05 20-06-58
Hélder Anselmo
Solution

Please remove the quotes after FirstParameterValue. The ID, coming from the aggregate is not a String, it's a reference.

2022-08-05 20-06-58
Hélder Anselmo
Solution

Hi Jessica,

This is the problem: 

FirstParameterValue:"EmployeeId"

Instead of "EmployeeId", you should replace it with: GetEmployeeById.List.current.Sample_Employee.id

2020-09-15 09-38-17
Jessica Marques

The alternative I found was to use a site property and assign it the screen id. Then use this id in the preparation of the screen that will be converted to PDF.

It Works, but honestly, I don't know if this would be the best option.

My concern is the competition. If more than one user clicks at the same time...

Regards,

Jessica. 

2018-10-18 08-34-00
Eric Bulters
 
MVP

Hi Jessica,

Did you already try to create an input parameter on the screen that generates the pdf, and pass it when downloading?

2020-09-15 09-38-17
Jessica Marques

Hi Eric,

Yes I already created the input id on the screen where I need to generate the PDF. In this case, I use the id to filter the aggregate and show the information (Name) in the expression. But my problem is how to get the id in Employee Detail and pass it to the GeneratePDF function. And finally configure it in EmployeePDF.

I´ am trying to set as Helder indicated, but I have problems yet. 

MakeAbsoluteURL(GetEntryURL("EmployeePDF",FirstParameterName:"EmployeeId",FirstParameterValue: EmployeeId))


2022-08-05 20-06-58
Hélder Anselmo

Hi Jessica,

When you call the GeneratePDF action, you obviously have the ID of your record to pass on (because you are also setting it in Site property as per your example - But please don't do it like that :) ). 

Instead, in your GeneratePDF, the URL you are passing should have the call to GetEntryURL, like:

MakeAbsoluteURL(GetEntryURL("EmployeePDF"))

Just change it to:

MakeAbsoluteURL(GetEntryURL("EmployeePDF",FirstParameterName:"EmployeeId",FirstParameterValue: EmployeeId))

(Changing the appropriate names to your scenario)


I hope it helps.

Cheers.

2020-09-15 09-38-17
Jessica Marques

Hi Hélder, 

Thanks for the attention, 

Into considerate the function "GetEntryURL", I´ am having problems to set the "FirstParameterValue"

Taking acount this cenarious could let me know what is the correct syntax do get the id on this function?

Considering this entity. 

I made the following tests, but just have a correctly pdf dinamic information, when I test with the id hard code (In this case I inserted just to test the expression). 

I´ looked for a exemple on outsystems´ documentation, but did found yet... 

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



2022-08-05 20-06-58
Hélder Anselmo

Hi Jessica,

Syntax looks good. The screen "EmployeePDF" has an input parameter "EmployeeId"? 

What's the problem you are having now?

2020-09-15 09-38-17
Jessica Marques

Hi Helder, 

yes, it has an input. 

When you say the correct syntax: will be that?

GetEntryURL("EmployeePDF",FirstParameterName:"EmployeeId",FirstParameterValue:"EmployeeId")

When I use this syntax. the erro that occurs is:


2022-08-05 20-06-58
Hélder Anselmo
Solution

Hi Jessica,

This is the problem: 

FirstParameterValue:"EmployeeId"

Instead of "EmployeeId", you should replace it with: GetEmployeeById.List.current.Sample_Employee.id

2020-09-15 09-38-17
Jessica Marques

Hi Helder, 

Actually, I already test like that:

MakeAbsoluteURL(GetEntryURL("EmployeePDF",FirstParameterName:"EmployeeId",FirstParameterValue:"GetEmployeeById.List.current.Sample_Employee.id"))

And show the following error:


2022-08-05 20-06-58
Hélder Anselmo
Solution

Please remove the quotes after FirstParameterValue. The ID, coming from the aggregate is not a String, it's a reference.

2020-09-15 09-38-17
Jessica Marques

Hi Helder, 

Perfect. Now it works. 

Thanks a lot the help. 

Cheers, 

Jessica Marques. 

2022-08-05 20-06-58
Hélder Anselmo
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.