Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript call programmatically the "Save as PDF" feature of Chrome dialog print

Google Chrome have the option "Save as PDF" when you enter the Print dialog or window.print(). The user need to choice this option in dialog to save the page as pdf.

Can I call some funcion or pass an argument to window.print() in chrome to "print" the page as a pdf without the print dialog appears?

Any ideas?

like image 232
suuuzi Avatar asked Feb 28 '14 13:02

suuuzi


1 Answers

Unfortunately there isn't any param you could pass to window.print(); and force it to print pdf unless there is a pdf driver plugin already present on the client's browser. There are plugins for firefox and IE (JS Print Setup and MeadCo Script respectively).

You may want to look at MrRio/jsPDF, a tool to generate pdf files at client-side JS.

like image 145
achhatre Avatar answered Sep 19 '22 22:09

achhatre