download html div into pdf using jsPDF

download html div  into pdf using jsPDF


download html div  into pdf using jsPDF


ADD THIS BETWEEN HEAD



<script src=”https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js”></script>
<script>
var pdfdoc = new jsPDF();
var specialElementHandlers = {
‘#ignoreContent’: function (element, renderer) {
return true;
}
};




$(document).ready(function(){


$(“#gpdf”).click(function(){


pdfdoc.fromHTML($(‘#printableArea’).html(), 10, 10, {


‘width’: 110,


‘elementHandlers’: specialElementHandlers


});


pdfdoc.save(‘gemscerti.pdf’);
});
});
</script>

Html Code



<button id=”gpdf” style=”display: none;”>Generate PDF</button>


<div id=”printableArea”>
<div id=”theme-page” style=”display: none;”>
            <div class=”table-content col-6″>
        <ul>
        <li id=”report_no”>Report No : 15074</li>
        <li id=”date”>Date : 25th of September 2018</li>
        <li id=”refe_no”>Reference No. : SHMHSNCC</li>
        <li id=”object”>Object : One faceted gemstone.</li>
        <li id=”weight”>Weight : 5.90ct</li>
        <li id=”deimen”>Dimension : 12.32×10.05×5.70mm</li>
        <li id=”shape”>Shape and Cut : Oval,(c)brilliant/(p)step</li>
        <li id=”colour”>Colour : Orange</li>
        <li id=”trans”>Transparency : Transparent</li>
        <li id=”Species”>Species : Natural Grossular Garnet</li>
        <li id=”Variety”>Variety : Hessonite Garnet</li>
        <li id=”Comments”>Comments : No indication of heat present.</li>
        </ul>
         </div>
</div>




<div id=”ignoreContent”>
</div>


download html div  into pdf using jsPDF,download html div  into pdf using jsPDF,download html div  into pdf using jsPDF

Related posts

Leave a Comment