printing - Save PDF from window.print in Javascript - Stack Overflow

Good day,I'm able to print a page using javascript. Using this codes:var win = window.open('&

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 badges
Add a ment  | 

1 Answer 1

Reset to default 1

You 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744076733a4554538.html

相关推荐

  • printing - Save PDF from window.print in Javascript - Stack Overflow

    Good day,I'm able to print a page using javascript. Using this codes:var win = window.open('&

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信