# Html 2 pdf

**URL:** <https://www.ruby-forum.com/t/html-2-pdf/109752>\
**Category:** Ruby\
**Created:** [July 18, 2007, 4:57pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752 "2007-07-18T16:57:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 18, 2007, 4:57pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/1 "2007-07-18T16:57:16Z")

</div>

Hi

IIs there a gem for converting html to pdf?

I need to build a routine to step through a website and create a pdf  
from the  
downloaded pages.

Thanks in advance

david Southwell

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 18, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/2 "2007-07-18T17:18:22Z")

</div>

David S. wrote:

> 

If not, you could probably just shell out to the open source htmldoc  
[Easy Software Products](http://www.easysw.com/htmldoc/). There’s a Perl interface you can learn  
from, HTML-HTMLDoc  
([http://search.cpan.org/~mkfrankl/HTML-HTMLDoc-0.10/](http://search.cpan.org/~mkfrankl/HTML-HTMLDoc-0.10/)). Or you could  
build something out of “hpricot” and “pdf-writer”.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 18, 2007, 7:10pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/3 "2007-07-18T19:10:31Z")

</div>

On 7/18/07, M. Edward (Ed) Borasky [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If not, you could probably just shell out to the open source htmldoc  
> [Easy Software Products](http://www.easysw.com/htmldoc/). There’s a Perl interface you can learn  
> from, HTML-HTMLDoc

This would probably work pretty good. I’ve done it before. A ruby  
wrapper for this would be most appreciated, if anyone is looking for a  
project!

> ([http://search.cpan.org/~mkfrankl/HTML-HTMLDoc-0.10/](http://search.cpan.org/~mkfrankl/HTML-HTMLDoc-0.10/)). Or you could  
> build something out of “hpricot” and “pdf-writer”.

If you do this, I suggest using Ruport instead of PDF::Writer for your  
PDF stuff. Of course, Ruport just wraps PDF::Writer, but it fixes  
some bugs (thanks to Austin Z.) and adds some higher level  
features and helps wrap the formatting code.

Some relevant docs if that’s feasible for you:

[http://rubyreports.org/cheatsheets/formatting.html](http://rubyreports.org/cheatsheets/formatting.html)  
[http://ruportbook.com/printable\_documents.html](http://ruportbook.com/printable_documents.html)  
[http://ruportbook.com/integration.html#pdf\_writer\_proxy](http://ruportbook.com/integration.html#pdf_writer_proxy)  
[http://ruportbook.com/renderer\_logic.html](http://ruportbook.com/renderer_logic.html)

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 20, 2007, 6:32pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/4 "2007-07-20T18:32:44Z")

</div>

On 7/20/07, John J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > pdf from the  
> > > [Easy Software Products](http://www.easysw.com/htmldoc/). There’s a Perl interface you can learn  
> > > be GNU tool to do it.  
> > > Sure, but nothing I’m aware of that doesn’t require a full browser  
> > > renderer  
> > > to work. The print to PDF feature as I understand it uses a modified  
> > > print  
> > > “driver” that converts the post script output into a PDF doc instead of  
> > > sending it to a printer. This is a far cry from just taking an  
> > > aribtrary  
> > > html file and making it a PDF.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 20, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/5 "2007-07-20T18:19:42Z")

</div>

On Jul 18, 2007, at 10:17 AM, M. Edward (Ed) Borasky wrote:

> >

No Good.  
It doesn’t even fully support HTML 4 !  
And no support for stylesheets…?  
There must be other alternatives.  
OS X has built-in print to PDF (has had for many years) so there must  
be GNU tool to do it.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 20, 2007, 11:01pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/6 "2007-07-20T23:01:17Z")

</div>

On Jul 18, 2007, at 07:56 , David S. wrote:

> IIs there a gem for converting html to pdf?
> 
> I need to build a routine to step through a website and create a  
> pdf from the  
> downloaded pages.

I have one that only works on OSX, but it works well. Lemme know if  
you want it and I’ll try to dig it up.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 20, 2007, 11:03pm UTC](https://www.ruby-forum.com/t/html-2-pdf/109752/7 "2007-07-20T23:03:17Z")

</div>

I want it:)
