In example on _http://rawgit.com/MrRio/jsPDF/master/#_ the autoprint example is Working, but when i use the same code in my project, it do nothig. There ist no error message too.
Im using the newest 1.3.3 version. As a browser, I use Chrome with version 56.0.2924.87.
function printPDF() {
var pdf = new jsPDF();
pdf.text("Hello world!", 10, 10);
pdf.autoPrint()
//pdf.save("TEst.pdf");
}
It already tried with and without save function.
What am I doing wrong?
Can someone help me?
have the same problem, fixing it like this
html
body
jsPDF AutoPrint Test
iframe id="output" width="0" height="0"
/iframe
/body
/html
script type="text/javascript" src="jquerymin.js" /
script type="text/javascript" src="js/jspdf.min.js" /
script type="text/javascript" src="js/jspdf.autoprint.js" /
script type="text/javascript"
_$('document').ready(function(){
var doc = new jsPDF();
doc.setFontSize(20);
doc.text(35, 25, "AutoPrint Test");
doc.autoPrint()
var iframe = document.getElementById('output');
iframe.src = doc.output('datauristring');
});_
/script
@MaxCodeDE @JMELBecha How to solve this issue?please help me.
@oqq5518 I have solve this problem like @JMELBecha . You have to create an iframe with css like display: none and run this code below. For me it works fine. But it isnt die clean way :(
pdf.autoPrint();
var iframe = document.getElementById('iframePDF');
iframe.src = pdf.output('dataurlstring');
this will hiden background page
var url = doc.output('datauristring');
$("<iframe>").hide().attr("src", url).appendTo("body");
Most helpful comment
@oqq5518 I have solve this problem like @JMELBecha . You have to create an iframe with css like display: none and run this code below. For me it works fine. But it isnt die clean way :(