HTML page to PDF (angular js and d3 diagrams)

I have a html page that can contain multiple d3 tables and diagrams, I want to export the whole page to pdf, is there a way to do this with angularjs or javascript, jquery. Thanks for the help.

+3


source to share


3 answers


Try using jsPDF ( http://mrrio.github.io/jsPDF/ ). I think this might help.



+2


source


try http://www.fpdf.org/ this is a php class that turns your html to pdf.



+1


source


You can use Kendo by setting the "id" to the container you want to export and then use the following code:

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 need to set the id like in this example:

<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 need a pdf image like jspdf / pdfmake.js that use canvas.

0


source







All Articles