Forum: Ruby PDFWriter and Page Breaks

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.
9e6d05909dc733af570faadce1392e67?d=identicon&s=25 Michael Satterwhite (msatterwhite)
on 2009-04-23 22:37
I'm sure this is something that someone here has done. More probably,
I'm missing the obvious.

In order to produce a report, I need to know when the text I'm printing
(or about to print - I'm not picky) is going to do a page overflow so
that I can put the neadings on the new page. I've been going through the
API, and I don't see how to check this.

Can anyone offer some insights into this?
Be07c8d0d6867fd9a0d525f7d17600e2?d=identicon&s=25 Damjan Rems (ther)
on 2009-04-24 09:30
Michael Satterwhite wrote:
> I'm sure this is something that someone here has done. More probably,
> I'm missing the obvious.
>
> In order to produce a report, I need to know when the text I'm printing
> (or about to print - I'm not picky) is going to do a page overflow so
> that I can put the neadings on the new page. I've been going through the
> API, and I don't see how to check this.
>
> Can anyone offer some insights into this?

It doesn't. You have to do it by yourself. If it is out of page borders
it will be printed out of borders.

by
TheR
9e6d05909dc733af570faadce1392e67?d=identicon&s=25 Michael Satterwhite (msatterwhite)
on 2009-04-24 13:33
> It doesn't. You have to do it by yourself. If it is out of page borders
> it will be printed out of borders.

That smart text insertion wraps both lines and pages is documented.
Unless the documentation is wrong, it won't be out of borders when using
the text method. The question is how to measure the height of the next
item to print so that I can do a "manual" new page and insert headings.

Even if smart text insertion didn't auto-wrap and "You have to do it by
yourself", the question remains the same. "How do I measure the vertical
height of the text I'm about to add to the document?"
8f433724b1f98215f69bf97dfbfa73d7?d=identicon&s=25 jonty (Guest)
on 2009-04-28 09:28
(Received via mailing list)
Why don't you try Prawn?

http://prawn.majesticseacreature.com/
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2009-04-30 06:55
(Received via mailing list)
On Tue, Apr 28, 2009 at 3:27 AM, jonty <jontyjont@btinternet.com> wrote:
> Why don't you try Prawn?
>
> http://prawn.majesticseacreature.com/

A good idea generally, but keep in mind that the OP will need to do
manual calculations whether he uses PDF::Writer or Prawn.  They just
might be slightly more pleasant to do in Prawn.  We do have very rough
header support, but anything interesting needs to be done manually
(for now).   Hopefully we'll improve in that area soon.

-greg
This topic is locked and can not be replied to.