i try to print automatically and save the file.
function freeRoomAvailableReport(tableId) {
var doc = new jsPDF('p', 'pt');
doc.text("From HTML", 40, 50);
var res = doc.autoTableHtmlToJson(tableId);
doc.autoTable(res.columns, res.data, {startY: 60});
debugger;
doc.autoPrint();
doc.save('table.pdf');
};
file is saved, but no print... tried on latest release of firefox and chrome without succes.
+1
I added doc.output('dataurlnewwindow'); after doc.autoPrint() and seems to work!
what browser, what release number?
Chrome 47 and FF 43. Not working on Safari.
Is it possible to avoid the PDF preview and directly go into printing?
PDFs have to be opened in a pdf-viewer, e.g. browser, so that autoprint can work. Saving the file will obviously not open the file in any viewer. So you always have to open the PDF. There is no shortcut or hack to directly print PDFs from javascript.
Most helpful comment
I added doc.output('dataurlnewwindow'); after doc.autoPrint() and seems to work!