I want to download my current web page into pdf on click of download button.Is it possible to do this using php codeigniter or javascript(jquery).Please suggest me.
4 Answers
it is simple to convert your web-page into pdf format.
you can use mPDf or you can use phantomjs
I've use both in may project, work perfect. using phantomjs you can convert your web-page in many formats.
mPDF example:
http://mpdf1.com/manual/index.php?tid=457
phantomjs:
http://phantomjs.org/examples/
in following example is for png or pdf
https://github.com/ariya/phantomjs/blob/master/examples/rasterize.js
- 152
- 1
- 13
There are many ways to do this. You can do this on the server side or you can use html5 or a jquery plugin to do this on the client side.
If you're doing it on the server side use a php library such as dompdf or tcpdf and create the file on the server and make it downloadable using proper headers.
If you're doing it on the client browser use a js plugin like jspdf. There are pros and cons on both methods.
Use DOMPDF for create pdf from php.
Download it from below link : https://github.com/dompdf/dompdf
- 693
- 5
- 21