tags:

views:

202

answers:

3

My PDF consists of a number of blocks (actually, a list of quotations), they go one after another till the end of the document. If the text of a quotation does not fit on the page, the whole quotation should start from the top of the next page, instead of being torn apart. How can I implement that on any library under ruby?

A: 

Try PrinceXML - this is a standalone executable that generates PDF out of HTML or XML. It supports a lot of special CSS properties that will even help you to control page breaks. Refer to http://www.princexml.com/doc/6.0/page-breaks/

This application is available for windows and linux. I was using it for generation of a pretty complicated PDF documents with headers and footers on every page except first one. And since you don't need to output a PDF with precise positioning of elements, it might be a perfect solution for you.

Alex Kaushovik
It is nice library, but my client didn't approve license for this library, so I am seeking for free solution
se_pavel
Unlicensed version of this program just puts a little icon at the very top right corner of the document. If your client don't mind that little icon - it could work :)
Alex Kaushovik
A: 

I haven't tried it, but in Prawn I would try using either the Document#text_box method or looking up the table methods and putting your text in cells with invisible borders. The documentation's unclear on how page break functionality fits in with the bounding box models, but it's worth a shot.

SFEley
A: 

HTMLDoc which converts HTML to PDF has a page break facility.

Kris