Forum: Ruby rendering pdf

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
67227642f4c9822bc306c8fe6a5f6742?d=identicon&s=25 twittwit (Guest)
on 2009-06-02 00:16
(Received via mailing list)
hello all,

i am new to ruby ( like two hours new! )  but i do know other
languages. I LOVE RUBY!

anyway, i want to code something to render my website into pdf. i have
seen these railscasts :
http://railscasts.com/episodes/153-pdfs-with-prawn
http://railscasts.com/episodes/78-generating-pdf-documents

they are super good but it seems that they are taking the elements and
reconstruct them into pdf.  I wonder is there something that can
duplicate  the webpage as it is ? ( ie, the entire layout will remain
the same as what is seem the webpage and the only difference is that
it is no longer html but pdf.)

if not, can someone enlighten me how i should approach this?


thank you all!

bryan
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2009-06-02 01:03
(Received via mailing list)
On Mon, Jun 1, 2009 at 6:15 PM, twittwit <ytbryan@gmail.com> wrote:

> they are super good but it seems that they are taking the elements and
> reconstruct them into pdf.  I wonder is there something that can
> duplicate  the webpage as it is ? ( ie, the entire layout will remain
> the same as what is seem the webpage and the only difference is that
> it is no longer html but pdf.)

If it's possible to use JRuby, look into FlyingSaucer.

-greg
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-06-02 10:17
Google "ruby html to pdf" gives these in the first few hits:

http://sublog.subimage.com/2007/05/29/html-css-to-...
(prince - commercial)

http://blog.adsdevshop.com/2007/11/20/easy-pdf-gen...
(htmldoc)

http://jimneath.org/2009/02/16/creating-pdf-docume...
(prince again, but the comments have some other suggestions)

Also, I had a vague idea there were Ruby bindings for at least one of
the HTML rendering libraries out there - a quick search for "ruby gecko"
turns up a project, but doesn't look like it has changed since 2005.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-06-30 12:43
I just came across another free (GPL) option for rendering HTML+CSS to
PDF: http://www.xhtml2pdf.com/

It's written in Python but apaprently can be invoked via the shell.
This topic is locked and can not be replied to.