javascript library to convert web page to pdf [closed]

做~自己de王妃 提交于 2019-12-03 17:20:09

问题


Is there any client-side library that can convert a web page to a PDF document? I have used jspdf but the generated pdf does not retain the formatted html (like tags should be boldface in the PDF).


回答1:


Very simple if your page is not having any sensitive data
Just Do this:

<a href="http://pdfcrowd.com/url_to_pdf/">Save this page to a PDF</a>


OR

Download this tool.

And you can invoke it on any event like:

<script>


  function generatePDF(){} 

  var conv = new ActiveXObject("pdfServMachine.converter");
  conv.convert("http://www.google.com", "c:\\google.pdf", false);
  WScript.Echo("finished conversion");
 }

 </script>
 <body onload="generatePDF()">
 </body>


var conv = new ActiveXObject("pdfServMachine.converter");
conv.convert("http://www.google.com", "c:\\google.pdf", false);
WScript.Echo("finished conversion");


OR
For more information
http://snapshotmedia.co.uk/blog/jspdf
http://itextpdf.com/
http://github.com/MrRio/jsPDF


来源:https://stackoverflow.com/questions/13491657/javascript-library-to-convert-web-page-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!