1

I'm developing a page and I need to export my page to PDF. Here 's an overview of my page https://i.stack.imgur.com/duafU.jpg

Library jsPdf:

    <script type="text/javascript" src="scripts/jspdf/jspdf.js"></script>
    <script type="text/javascript" src="scripts/jspdf/jspdf.plugin.standard_fonts_metrics.js"></script> 
    <script type="text/javascript" src="scripts/jspdf/jspdf.plugin.split_text_to_size.js"></script>               
    <script type="text/javascript" src="scripts/jspdf/jspdf.plugin.from_html.js"></script>
    <script type="text/javascript" src="scripts/jspdf/jspdf.plugin.addimage.js"></script>
    <script type="text/javascript" src="scripts/jspdf/jspdf.plugin.cell.js"></script>
    <script type="text/javascript" src="scripts/jspdf/libs/Deflate/deflate.js"></script>
    <script type="text/javascript" src="scripts/jspdf/libs/Blob.js/Blob.js"></script>
    <script type="text/javascript" src="scripts/jspdf/libs/FileSaver.js/FileSaver.js"></script>

Here 's the js code for jspdf:

 function demoFromHTML() {
     var doc = new jsPDF('p', 'in', 'letter');
     var source = window.document.getElementsByTagName("body")[0];
     var specialElementHandlers = {
         '#bypassme': function(element, renderer) {
             return true;
         }
     };

     doc.fromHTML(
         source, // HTML string or DOM elem ref.
         0.5,    // x coord
         0.5,    // y coord
         {
             'width': 100, // max width of content on PDF
             'elementHandlers': specialElementHandlers
         });

     doc.output('dataurl');
}

When I click the button, it returns a pdf like this and I'm a total newbie in this jsPDF so I don't know what I did wrong

https://i.stack.imgur.com/5c7Oy.jpg

SlashBunny
  • 27
  • 1
  • 6

0 Answers0