how to use addHTML function in jsPDF

Could you please let me know how to use addHTML function in jsPDF libraries. Am trying to convert a webpage as pdf. want to use the addHTML function. Let me know what parameters need to be passed to get the entire webpage converted as pdf with header, logos, body etc

First, you have to include jsPDF library, and also html2canvas or rasterizeHTML.

Then, just create a jsPDF object and save to pdf the entire ‘body’ tag (or whatever):

var pdf = new jsPDF('p','pt','a4');
pdf.addHTML(document.body,function() {'web.pdf');
<script src=""></script>
<script src=""></script>

    <p id="to-pdf">HTML content...</p>

You can find more examples on the jsPDF website:

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   How to refresh a Page using react-route Link

Similar Posts