Use JSPDF for Exporting Data HTML as PDF in 5 Easy Steps

by Applied Informatics

JSPDF is the HTML5 client-side solution for generating PDFs. This is perfect for event tickets, reports, and certificates. Just include the JSPDF library in your <head>, generate your PDF using the many built-in functions.

You can use pdf from html as follows,

STEP 1. Download the Files From Github.

STEP 2. Add the Following Files in the Header

<em><span style="font-size:small;"><script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script> </span></em>
<em><span style="font-size: small;"><script type="text/javascript" src="jspdf.js"></script> </span></em>

<em><span style="font-size: small;"><script type="text/javascript" src="jspdf.plugin.standard_fonts_metrics.js"></script> </span></em>

<em><span style="font-size: small;"><script type="text/javascript" src="jspdf.plugin.split_text_to_size.js"></script> </span></em>

<em><span style="font-size: small;"><script type="text/javascript" src="jspdf.plugin.from_html.js"></script>

or just use link below:

<script src=”//”></script>


function demoFromHTML() {
var doc = new jsPDF('p', 'in', 'letter');
var source = $('#testcase').first();
var specialElementHandlers = {
'#bypassme': function(element, renderer) {
return true;

source, // HTML string or DOM elem ref.
0.5, // x coord
0.5, // y coord
'width': 7.5, // max width of content on PDF
'elementHandlers': specialElementHandlers


STEP 4. Add Your Body Content

<a href="javascript:demoFromHTML()" class="button">

<div id="testcase">

We support special element handlers. Register them with jQuery-style.


Browser Compatibility:

jsPDF will work in IE6+*, Firefox 3+, Chrome, Safari 3+, Opera. For IE9 and below.

7 thoughts on “Use JSPDF for Exporting Data HTML as PDF in 5 Easy Steps”

  1. I got this error:end3.html?_ijt=emim25bojm94mk740fq0sng274:1 Not allowed to navigate top frame to data URL: data:application/pdf;base64,JVBE… etc

Leave a Reply

Your email address will not be published. Required fields are marked *

Tools & Practices

Tools and Technologies we use at Applied

Contact us now

Popular Posts