Hello,
I have this to generate PDF using library jsPDF:
<script type="text/javascript">
print = function () {
var rowid = jQuery("#list1").jqGrid("getGridParam","selrow");
var row = $("#list1").getRowData(rowid);
// JSPDF, docs: http://rawgit.com/MrRio/jsPDF/master/docs/global.html
// Default export is a4 paper, portrait, using milimeters for units
var doc = new jsPDF()
// set font size
doc.setFontSize(12);
doc.text("Invoice #" + row["id"],10,10);
doc.text("Cliente: " + row["customer"],10,14);
doc.text("Total: " + row["total"], 10, 18);
doc.text("Fecha: " + row["due_date"], 10, 22);
//doc.save("a4.pdf");
doc.autoPrint();
doc.output("dataurlnewwindow");
// this opens a new popup, after this the PDF opens the print window view
});
</script>
And this buttton to call function:
$buttons_html = "<button onclick='print()' class='fancybox' data-fancybox-type='iframe' >Print</>";
Show me error and not load file .pdf
Thank you!
Working demo code attached. Review line 117, 142-166
https://gist.github.com/gridphp/dd5c7382e8eb859ab0716ca481509570
This thread was partially resolved using window.open so:
window.open(doc.output('bloburl'), '_blank',"toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes,top=200,left=350,width=600,height=400");
I'll try to add custom code in jsPDF.js library in uri parameters.
Thank you!