.html/.html.erb/.rhtml to PDF

Hello All,

I wanted to convert .html file into .pdf.

is there any rails plugin ??

Thanks,

Sandip R~

http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-rails

However, PrinceXML is not free: http://www.princexml.com/purchase/

That said, it works extremely well, producing PDFs that are simply amazing.

Best regards

Peter De Berdt

I'd also recommend princexml if you can afford it. And I'm a big f/ oss proponent. Been using it on a couple of apps for clients in the past couple of years and have been very happy with results. The coverage of (standard) print-related css is very good. I can't tell you how much time has been saved by going the html/css -> pdf route, instead of generating pdf on-the-fly in app code.

I am always on the lookout for f/oss alternatives. One of the latest alternatives I've looked at that's getting pretty close (to meeting the specific needs of the projects I'm working on):

wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/

Also, for anyone interested, If you need to do any post-generation pdf testing/manipulation (splitting, combining, ....), a couple other tools I'd recommend to use as well:

pdftk

pdfopt

Jeff

Thanks !

Sandip R~

Hi Jeff

svn checkout http://wkhtmltopdf.googlecode.com/svn/trunk/ wkhtmltopdf

cd wkhtmltopdf
cmake -D CMAKE_INSTALL_PREFIX=/usr .
make

I am getting following error, do you have any idea ?

wkhtmltopdf.dir/wkhtmltopdf.cc.o -c /home/sandip/wkhtmltopdf/wkhtmltopdf.cc /home/sandip/wkhtmltopdf/wkhtmltopdf.cc: In function ‘int main(int, char**)’: /home/sandip/wkhtmltopdf/wkhtmltopdf.cc:556: error: ‘setGraphicsSystem’ is not a member of ‘QApplication’

make[2]: *** [CMakeFiles/wkhtmltopdf.dir/wkhtmltopdf.cc.o] Error 1 make[2]: Leaving directory /home/sandip/wkhtmltopdf' make[1]: *** [CMakeFiles/wkhtmltopdf.dir/all] Error 2 make[1]: Leaving directory /home/sandip/wkhtmltopdf’

make: *** [all] Error 2

Thanks,

Sandip R~

I've always just used the statically compiled version of wkhtmltopdf (for testing). If you can't use the static version, might want to search/work-with-maintainers to resolve build-from-src problems. Best of luck,

Jeff

You need version 4.5 of the QT library.

Hi guys ! I used prawn to generate pdf document. its clean and simple to code. but i am facing one problem. In one of my table row i wanted to “Total IDV” text aligned centered. but its not working.

[ {:text => “Total IDV”, :colspan => 3, :align => :center },“#{ total_idv }” ] NOTE: :text_align => :center, :align => :center is not producing any effect. Do you have any ideas ??

Cheers ! Sandip R~

Hi Sandip,

bill walton wrote:

Hi Sandip,

Do you have any ideas ??

You might want to ask CSS questions on the css-d list.

Looks to me like Sandip had Prawn questions, not CSS questions -- in which case he should ask the Prawn team.

Best,

Thanks Marnen !

i will ask question to prawn team

Sandip R~

Sandip Ransing wrote:

Hi Jeff

svn checkout http://wkhtmltopdf.googlecode.com/svn/trunk/ wkhtmltopdf cd wkhtmltopdf cmake -D CMAKE_INSTALL_PREFIX=/usr . make

I am getting following error, do you have any idea ?

wkhtmltopdf.dir/wkhtmltopdf.cc.o -c /home/sandip/wkhtmltopdf/wkhtmltopdf.cc /home/sandip/wkhtmltopdf/wkhtmltopdf.cc: In function ‘int main(int, char**)’: /home/sandip/wkhtmltopdf/wkhtmltopdf.cc:556: error: ‘setGraphicsSystem’ is not a member of ‘QApplication’ make[2]: *** [CMakeFiles/wkhtmltopdf.dir/wkhtmltopdf.cc.o] Error 1 make[2]: Leaving directory `/home/sandip/wkhtmltopdf' make[1]: *** [CMakeFiles/wkhtmltopdf.dir/all] Error 2 make[1]: Leaving directory `/home/sandip/wkhtmltopdf' make: *** [all] Error 2

is wkhtmltopdf worked in solaris machine.. i got error....