admin管理员组文章数量:1357225
Good day,
I'm able to print a page using javascript. Using this codes:
var win = window.open('', 'print', 'height=720,width=300');
...
win.document.write(document.getElementById("myDivToPrint").innerHTML);
win.document.close();
win.focus();
win.print();
But my problem is, is there a way to save this on my server api? I tried this,
var myPdf = win.output(); // Doesn't work, not found
I want to get at least the encoding of the pdf to be able to save it on my server. Is it possible? if yes, please help me how.
Good day,
I'm able to print a page using javascript. Using this codes:
var win = window.open('', 'print', 'height=720,width=300');
...
win.document.write(document.getElementById("myDivToPrint").innerHTML);
win.document.close();
win.focus();
win.print();
But my problem is, is there a way to save this on my server api? I tried this,
var myPdf = win.output(); // Doesn't work, not found
I want to get at least the encoding of the pdf to be able to save it on my server. Is it possible? if yes, please help me how.
Share Improve this question asked Jan 29, 2019 at 9:21 AppleCiderYummyAppleCiderYummy 3892 gold badges9 silver badges23 bronze badges1 Answer
Reset to default 1You can't use print if you want to save the PDF as print uses the browser print function.
if you use jQuery check this previous post Generate pdf from HTML in div using Javascript
You'll need to convert the HTML in PDF and then send a request to your server to save the file
本文标签: printingSave PDF from windowprint in JavascriptStack Overflow
版权声明:本文标题:printing - Save PDF from window.print in Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744076733a2586884.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论