Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter+Bootstrap - Convert HTML to PDF

Before you say it's a duplicate of another question, please read on.

My development environment is :

  • CodeIgniter
  • Twitter Bootstrap

What I need :

  • To be able to convert a piece of HTML code (or a complete webpage for that matter), exactly as it appears as a PDF.

Hints :

  • I know about domPDF (a common solution, with a helper already available for CodeIgniter users), and I've used it in the past; the thing is it does NOT support real conversion (if I have to convert all my bootstrap css to tables, then it's close to useless).
  • I'm thinking of using some terminal utility (triggered via ajax?), like wkHtmlToPdf

What would you suggest?

like image 296
Dr.Kameleon Avatar asked Aug 16 '12 19:08

Dr.Kameleon


1 Answers

I have successfully used wkHtmltoPdf in the past to convert HTML pages to PDF. One thing of caution however is to check and if necessary strip out javascript in the HTML pages, because from time to time, I have found that sometimes they screw up the rendered PDF. Do not worry about pre-written CI helpers, you can easily integrate wkHtmltoPDF as a library in CI

like image 194
raidenace Avatar answered Sep 21 '22 22:09

raidenace