Leonel Elimpe
by Leonel Elimpe
~1 min read

Tags

  • Angular
  • jsPDF
  • PDF Generation with Angular

I may flesh this out with a detailed post later, but if you have any questions or encounter any issues feel free to reach out to me.

Here’s the sample project on GitHub, and here’s the demo application. It demonstrates generating a PDF document in Angular with jsPDF, with features like a header, a footer, header and footer formatting, tables, page numbers, font size, and margins.

You should however note that generating PDF documents with Javascript won’t really get you much, you’re better off using a backend technology. This is suitable for quickly printing stuff like invoices, event tickets, reports, certificates,etc.

When you click the Generate button, a copy of the generated pdf will be downloaded automatically and it’ll also be displayed in a dynamic iframe on the demo page. The demo pulls a couple paragraphs from the api https://jsonplaceholder.typicode.com/comments to flesh out the document.

Hope this helps you out somehow, happy coding!