Reputation: 972
I have a html page with a form ,with few input fields, check box,radio buttons. User can fill up the forms.
Is there any way , the user will be able to download the form (with the filled in data) in pdf format ?
1 more question, Any way to save the filled in form in html format or image format (of course File-> save of browser and screenshot are there) using java script code or html code , on a button click ?
I have tried http://code.google.com/p/jspdf/ , didnot able to get through it.
Thanks
[Adding a few more points] if generating a pdf file using JS/HTML is not possible then .... A bit more into it
Currently I am creating a server using C# application and when user requests a html page , I am sending the same to user. that html page contains a form , which is needed to be filled and I want the user to save the filled form in pdf format. For now , I am able to process the static html form -> convert to pdf and provide the download to user ,
But can't get a way to enable the user to save the filled in form. When the user presses the submit button , I can get all the filled in data using httpResponce object(GET/Post Method)!! , is there a way I can generate a pdf file using this httpResponce object parameters? Or any way I can send the current html page content (e.g. getting all the contents in a div using jquery/javascript) and send it back, when user presses the submit button, in that way I can generate the pdf file at server side and provide a download - PDF format
Please ask , if I am not able to describe my question !!
Upvotes: 3
Views: 4203
Reputation: 5389
jsPDF is an open-source library written by our lead developer, James, for generating PDF documents using nothing but Javascript. You can use it in a Firefox extension, in Server Side Javascript and with Data URIs in some browsers. http://snapshotmedia.co.uk/blog/jspdf
Using only javascript to generate the PDF is not possible at this time. Using server-side scripting, it is possible to send the data to a server and let the server generate the PDF which is then sent to the user.
(Update): Using PHP, you can generate PDFs in the server-side using dompdf - HTML to pdf converter. Here is a demo: http://eclecticgeek.com/dompdf/docs_0-6-0/demo.php
In Google Chrome, there is a "Print to PDF" option. If you don't want to do any programming on the server side, you can just ask your users to access the page using Google Chrome. After filling out the form, they print the page as PDF.
Upvotes: 2