Gopal Chitalia
Gopal Chitalia

Reputation: 462

How to turn an html/css form into a pdf without changing its css layout?

I have a form which contains certain fields . So , What I want is, when the user enters those certain fields and submits the form , it should generate a PDF out of it. Can anyone help me out it ?

What I have done is , I have redirected the form to a new HTML page, got all the data which has to be processed to new page. And then I am stuck as to how to proceed . I am using the naive method of saving the generated HTML and then converting that generated HTML to PDF from command line .

Is there a better method ?

Upvotes: 0

Views: 167

Answers (1)

chriscrutt
chriscrutt

Reputation: 529

There are a few ways to get a pdf from your html

  1. window.print(); in JS

  2. already answered here using jquery, but only to a certain degree, it doesn't support colors or images or other things

  3. lastly I recommend jsPDF which was another answer to a question somewhat like yours

Upvotes: 2

Related Questions