Summary
This article describes how to use JSDPF in Angular to generate PDFs from HTML. For better understanding, here is an example of using JSDPF to generate a PDF from HTML.
This jsPDF plugin adds the ability to parse HTML tables or use Javascript data directly to generate PDF tables.
jsPDF is a JavaScript-based module. It is used to generate PDFs on the client side and provides a variety of easy ways to adjust the PDF view.
We can also modify size,Orientation,UI and other features also available.
Requirement
- Angular >2
- HTML / Bootstrap
Creating a project
I created a project using the following command at the command prompt:
Creating Project
Installation
Install JSPDF using the below command,
App.module.ts
app.component.html
app.component.ts
Let's run the project and see the result
You can download PDF by clicking on the download icon
For more detail click here