From: "Taelor Mr." Date: 2009-11-04T03:17:18+09:00 Subject: Re: PDF::Writer - measure size of a section before rendering it? Max Williams wrote: > I'm a dumbass...for approach 2, i just need to make a new PDF::Writer > object and test my section size on that. What would be nicer though, is > instead of redoing everything on my real pdf after testing it on the > temp one, i could just copy the contents across. Does anyone know a way > to do that? > > thanks > max Hey man, this is what I did. If you can extend PDF::Writer that class or just open that class up, then you can add this function. If the markup comes out horrible, look at http://gist.github.com/224821
  def wrap_it(&block)
    new_pdf = ConsoloPdf.new
    beginning_y = new_pdf.y

    yield new_pdf

    new_pdf_height = beginning_y - new_pdf.y

    self.start_new_page if self.y < new_pdf_height

    yield self
  end
-- Posted via http://www.ruby-forum.com/.