Jspdf: Autoprint not functional

Created on 30 Sep 2015  路  6Comments  路  Source: MrRio/jsPDF

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.

Most helpful comment

I added doc.output('dataurlnewwindow'); after doc.autoPrint() and seems to work!

All 6 comments

+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.

1567

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glaier picture glaier  路  3Comments

BarathArivazhagan picture BarathArivazhagan  路  4Comments

mellisa0109 picture mellisa0109  路  3Comments

NoFootDancer picture NoFootDancer  路  3Comments

mackersD picture mackersD  路  4Comments