se_pavel
se_pavel

Reputation: 2208

PDF generation under ruby - block should not cut by page separator

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?

Upvotes: 1

Views: 374

Answers (3)

Kris
Kris

Reputation: 19938

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

Upvotes: 0

SFEley
SFEley

Reputation: 7766

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.

Upvotes: 0

Alex Kovshovik
Alex Kovshovik

Reputation: 4215

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.

Upvotes: 1

Related Questions