At a high-level, what steps would you use to automatically generate a PDF document and store either in the DB or on the filesystem?

I have installed the SimpleReportsWithPDF and HtmlToPdfConverter applications and played around with them a bit. The "Download" action on SimpleReportsWithPDF/Print Menu seems to do what I intend in a batch/background format.

At a technical level, if this is performed in a background/batch manner, I don't need to send to HTML (or do I?) I really just want to take some data, format into a PDF and store for use later (email, print, etc)

Thank you

Jeff W.


Solution

Hi, Jeff, 

After having the report in Html, just call the function to convert to PDF, which will return you a binary file that can be saved in the database.

Remember that your page must be anonymous, (you should not ask for user login), do not reference session variables because the component will make a new request without taking advantage of the current session. 


Any questions or need an example, I am at your disposal.


Huarlem Lima 

Solution

Huarlem Lima wrote:

Hi, Jeff, 

After having the report in Html, just call the function to convert to PDF, which will return you a binary file that can be saved in the database.

Remember that your page must be anonymous, (you should not ask for user login), do not reference session variables because the component will make a new request without taking advantage of the current session. 


Any questions or need an example, I am at your disposal.


Huarlem Lima 

Thank you for the reply Huarlem!  I've made very good progress this evening with the suggestions you provided. I'm not quite finished with the original solution but this has helped me a lot. Thank you again.

Jeff W.


Huarlem Lima wrote:

Hi, Jeff, 

After having the report in Html, just call the function to convert to PDF, which will return you a binary file that can be saved in the database.

Remember that your page must be anonymous, (you should not ask for user login), do not reference session variables because the component will make a new request without taking advantage of the current session. 


Any questions or need an example, I am at your disposal.


Huarlem Lima 

Hi Huarlem Lima,

       Can you please demonstrate an example for this process? I would really be helpful.

Thanks,

Ebina Sony

Hi Ebina,

There is a example in this component, on the download link for the report.

https://www.outsystems.com/forge/component/1771/simple-reports-with-pdf/

Any doubt I am available.

Thanks Huarlem Lima, But I need a working demo for a mobile application not for web application. 

I have managed to create a report and open it on a seperate tab. I understand the download-button, works flawless. Thanks for you example. really helped me a lot.

Now I have a different scenario: I would like to create a binary pdf-file based on the html-report without use-rintervention. So, not opening a new tab, not pushing any download button. I just want to create a pdf based on a html-outsystems-page and store it in the db. How can I do this? 

Wow, that wasn't the smartest question. You can create a pdf from url by using the method GeneratePDF from HtmlToPdfConverter. It returns PDFBinary, a variable of type Binary Data. You can do anything with it, download it or store in the DB.