I want to create a PDF document from HTML in JavaScript. I tried using the library jsPDF
but all the HTML formatting are not supported in it. Is there any other library that I can use to create the PDF?
Generate PDF using JavaScriptSpecify the content in text() method of jsPDF object. Use the addPage() method to add new page to PDF. Use the save() method to generate and download PDF file.
We can start by introducing jsPDF, jsPDF is an open-source library for generating pdf using only JavaScript. It simply creates a pdf page and applies your formatting to the page. Note that we can change the presentation of the data inside the downloaded PDF file by editing the orientation and format.
I've just written a library called jsPDF (Give you the link below) which generates PDFs using Javascript alone. It's still very young, and I'll be adding features and bug fixes soon. Also got a few ideas for workarounds in browsers that do not support Data URIs. It's licensed under a liberal MIT license.
I came across this question before I started writing it and thought I'd come back and let you know :)
http://code.google.com/p/jspdf/
http://hayageek.com/generate-pdf-with-javascript/ //Try this link with step by step process
You can create the html page as you like to have PDF then from javascript you can call print function of the browser which eventually exports a webpage to a pdf or in printable form
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With