Print to printer / PDF

We are looking for an option to print to a printer or PDF. Currently hitting print on the browser (Windows Chrome) sends to a print preview that is less than ideal. There are scroll bars when they shouldn’t be there. There is a header bar that has my login initials and circle. There is the ‘edit’ button in the top right.

We would like a way to print the page to a format that fits nice and clean on a letter style format or template. Maybe a report generator? This option would lead us into another solution of printing tickets like a McDonald order and receipt system. But mainly we are looking for a letter format print option. Thanks.

1 Like

Hello @Mhazrat! This is a pretty common ask (How to share a report) - we’ll definitely take a look!

1 Like

It may be a similar request but our end goal is to be able to print on 8.5x11 letter standard page for our factory floor and eventually to a receipt style printout. Thanks for looking into it.

2 Likes

Same here… would be nice to have this as a built in feature.

Hey @Mhazrat and @mbilliodeaux!

We recently added a utility for downloading the current page as a PDF using Javascript! https://docs.retool.com/docs/scripting-retool#utilsdownloadpagefilename-string

Can you post an example? I’m trying to add the optional parameters and nothing is being excluded.

Hi @scottcrowley!

Here's a quick example of the utils.downloadPage

From the docs:
utils.downloadPage(fileName, { selectorsToExclude, componentsToExclude, scale, fullscreen })

Example:

utils.downloadPage("filename123", { selectorsToExclude:["#retool-widget-text10 > div.ant-tag.show-when-dragging"], componentsToExclude:['text10','textinput1'], scale: 1,  fullscreen: true})

To grab the specific CSS selectors to exclude, you can go into the browsers dev tools and use the copy selector button:

Hopefully this helps!

2 Likes

That’s way clever!

1 Like

This script works to save the PDF as the page shows which is great. The next issue is formatting the PDF to export in 8.5 x 11 page format regardless of the window size. Also looking for a 4x6 card format as well to print to a Zebra label printer in shipping. Thanks!

Is it normal that the navigation bar messes a bit the document?