jsPDF Tutorial to Export QR Code or Bar Numerical Code to PDF Document in Browser Using Javascript Full Project For Beginners

 

 

Welcome folks today in this blog post we will be exporting qr code or bar numerical code to pdf document in browser using jspdf library in javascript. All the full source code of the application is shown below.

 

 

 

Source Code

 

 

 

index.html

 

 

 

<img id='itf' />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.4.0/jspdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsbarcode/3.9.0/JsBarcode.all.js"></script>
<script>
  JsBarcode("#itf", "12345678901237", {format: "itf"});

const img = document.querySelector('img#itf');

var doc = new jsPDF();
doc.setFontSize(40);
doc.text(30, 20, 'Hello world!');
doc.addImage(img.src, 'JPEG', 15, 40, 180, 160);
doc.save('my.pdf');
</script>

Leave a Reply