I have a web app and I need print the data into pdf. In back-end I use php, while in front-end a javascript MVC framework (backbone.js).
I don't know if generate the pdf only using javascript (..then using data cache) or using ajax that will call a php page that will generate the pdf... What's the better solution?
Naturally I need be able to print, save and use the stylesheet for pdf.
Thanks.
I prefer mPDF to generate PDFs:
You can generate the PDF using PHP and grab it by doing an AJAX call, that's the only good way. Of course in mPDF you can style document using CSS.
If you want read PDF using javascript, read: Open Source Javascript PDF viewer
edit: now it's 2016 and mPDF is for sure not recommended, deprecated piece of software. There exists much better ones, just take a look at GitHub:
PHP: https://github.com/search?l=PHP&o=desc&q=pdf&ref=searchresults&s=stars&type=Repositories&utf8=%E2%9C%93
JavaScript: https://github.com/search?utf8=%E2%9C%93&q=node+pdf&type=Repositories&ref=searchresults
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