HtmlToPDF - Export to PDF without Preview

HtmlToPDF - Export to PDF without Preview

Hi everyone!

I have a web screen where the data to be printed is present, along with the button to be able to export them to PDF. How could I remove the buttons in the document after export. I've tried setting variables in the Visible property of the buttons but to no avail.

Hi Ju-Chan,

Have you tried using the "media" options in CSS for the page? If you give the buttons or the container of the buttons a specific class, you can use a media-specific CSS section to change the style of those buttons to display:none when being rendered for printing. They'll appear on the screen in the browser itself, but not when printed out.

Or are you using the HTML-to-PDF component to render and download a PDF file? If so, I usually feed the PDF component a URL to the page with a separate parameter on, which you can use to contol whether the "download PDF" button appears.

Sorry this reply is a bit rushed. Let me know if these hints help, or if you'd like a deeper explanation / example.

Kind regards,

Andrew Burgess,
OutSystems UK
I'm using the HTML to PDF component.

I think there are parameters involved inside the query string. May I know where could I find the API documentation for this component or even a small documentation about the HtmlToPdf component?

It's okay. Kindly give me an example about that. Thank you!
Hi Ju-chan,

I've attached a sample eSpace that demonstrates viewing a report page in the browser with a "Download" button on it, where clicking the button downloads a PDF version of the page, but without the "Download" button visible. Hopefully this is similar to what you were trying to achieve.

I've done it by adding a parameter to the page that renders the report, indicating whether it is "in preview" mode or not. When the URL for the report page is constructed ready to be passed to the HTML to PDF converter, the parameter value is set to indicate it is not preview. Within the page, the "download" button is placed within an IF block that says only show that section if in preview mode. (There are several ways to generate the URL for the HTML to PDF converter, I've picked a relatively simple one - there are better ways though.)

Let me know if this helps!