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

Hello All,

I wanted to convert .html file into .pdf.

is there any rails plugin ??

Thanks,

Sandip R~


Ruby on Rails Developer

On 13 Jul 2009, at 09:55, Sandip R. wrote:

I wanted to convert .html file into .pdf.

is there any rails plugin ??

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

However, PrinceXML is not free: Prince - Buy Prince

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

Best regards

Peter De Berdt

Peter De Berdt wrote:

On 13 Jul 2009, at 09:55, Sandip R. wrote:

I wanted to convert .html file into .pdf.

is there any rails plugin ??

Prince looks great if you can afford it. Some of the folks at my local
users’ group mentioned a couple other options (which I haven’t yet
tried):

  • flyingsaucer is a HTML-to-PDF renderer. It’s written in Java, but
    even if you’re not using JRuby, you could shell out to it. It probably
    wouldn’t be hard to modify the Princely plugin to work with this.

  • prawn_formatter lets you use HTML syntax in generating PDF files with
    Prawn, so it might work for converting HTML to PDF.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thanks !

Sandip R~

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

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

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~

Ruby on Rails Developer

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~

You need version 4.5 of the QT library.

Hi Sandip,

On Thu, 2009-07-16 at 21:54 +0530, Sandip R. wrote:

Do you have any ideas ??

You might want to ask CSS questions on the css-d list. They’re experts
and are very helpful. Make sure you validate your html before you ask
for help though (http://validator.w3.org)

Best regards,
Bill

bill walton wrote:

Hi Sandip,

On Thu, 2009-07-16 at 21:54 +0530, Sandip R. wrote:

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,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thanks Marnen !

i will ask question to prawn team

Sandip R~

Sandip R. 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…