Auto Print PDF to Printer on Button Click

I currently have an action button for Print which on click generates the PDF exporter which within chrome auto downloads to the browser. Currently I need to click to open the pdf and than use computer browser print to print which once again adds the step to click print on the print preview

Is there a way to auto print the PDF generated from PDF exporter

Hey @seandawes!

I don't believe there is a way to directly print from within Retool. Since all JS in Retool is run in a sandbox, so a lot of window functions (like window.print() )won't work here. You can however use window.print() in a custom component if you toggle on "allow modals" in the component inspector and pass your PDF to the component through the model but this would print the full custom component iframe, you may be able to use a JS library from here, but I haven't had any luck yet with my current setup using printJS

@Chris-Thompson Thanks. Its not so much I guess a big deal when using an ipad given ios but just trying to reduce steps and basically making a print packing slip function

Hey @seandawes — I see full transparency here, at the moment, mobile development has not been a primary focus. We do have a team now dedicated to mobile development so hopefully, this will be even better soon! In the meantime, I believe the best approach for building out an easily customizable packing slip would either be the window.print() in a custom component or possibly an external API. Do you think either of these could work for your use case here?

Hey seandawes,
I am unable to get in pdf format. how did you do that. can you guide me. i can generate doc or json or csv but not pdf.

Hey @Geetha2021!

If you are looking to download a PDF of a portion of your app, you can use utils.downloadPage() and pass this function two params, the first would be a string representing your desired file name and the second is an object of additional optional params. Here's a link to our docs on this that could be helpful here. Let me know if you have any questions! :slight_smile: