简体   繁体   English

HTML页面到PDF(角度js和d3图表)

[英]HTML page to PDF (angular js and d3 charts)

I have html page which may contains multiple tables and d3 charts, i want to export whole page to pdf, is there way to do it using angularjs or by javascript,jquery. 我有html页面,可能包含多个表和d3图表,我想将整个页面导出为pdf,有没有办法使用angularjs或javascript,jquery。 Thanks for help. 感谢帮助。

Try this to use jsPDF ( http://mrrio.github.io/jsPDF/ ). 试试这个以使用jsPDF( http://mrrio.github.io/jsPDF/ )。 I think it can help. 我认为它可以提供帮助。

试试这个http://www.fpdf.org/这是一个将你的html变成pdf的php类。

You can use Kendo , setting an "id", in the container that you want to export, and then use the following code: 您可以在要导出的容器中使用Kendo设置“id”,然后使用以下代码:

kendo.drawing.drawDOM($("#exportthis"), {
       paperSize: "letter",
        margin: "0.5cm",
        scale: 0.5
   }).then(function(group) {
     kendo.drawing.pdf.saveAs(group, "Converted PDF.pdf");
   });

in your view you have to set the id like in this example: 在您的视图中,您必须像在此示例中一样设置ID:

<div id="exportthis" class="...">
  ... more HTML code here...
</div> 

then a button where we can call the function, and its ready to go. 然后我们可以调用该功能的按钮,并准备好了。

I use this when i don't want an image on the pdf, like jspdf/pdfmake.js that use canvas. 当我不想在pdf上使用图像时,我会使用它,例如使用canvas的jspdf / pdfmake.js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM