how to generate a pdf file of an html page through java script programming

In my html5 hybrid iPad application i am generating a report in one of the pages . What i want is to generate a PDF file of that report and save it in ipad.Please help me with this. I am using JavaScript and mobile jQuery for this.

Answers


It is highly inefficient to do this client-side(via Javascript). You should consider doing it server-side(using PHP, ASP/.NET or such). PHP uses a service called iTextSharp for this, PHP uses DOMPDF.


If you want to it with Javascript, http://html2canvas.hertzen.com/ is the best tool you will find! It uses the DOM style to generate an image. The only thing you need to do is then wrap it in a PDF. Have a look at their examples! For example:

http://html2canvas.hertzen.com/examples/artificial/index.html


You can use an open-source library for generating PDF documents, I have already use this library and works fine: http://code.google.com/p/jspdf/

Try it, I hope that is what you want


Need Your Help

jQuery UI confirmation dialog and asp.net postback

asp.net jquery jquery-ui jquery-ui-dialog

I have a delete button in a gridview. For those not familiar with asp.net my delete button outputs like so:

what happens to ASP.NET exceptions from created non-threadpool thread?

c# asp.net multithreading exception-handling

In ASP.NET web application a worker thread creates a non-threadpool thread like below: