From: Max Williams Date: 2008-09-08T17:42:33+09:00 Subject: PDF::Writer - measure size of a section before rendering it? I'm using the PDF::Writer plugin and have got everything that i wanted working except for one thing: I have sections that i don't want to split over a page. I tried a couple of ways of dealing with this, each of which has problems. Can anyone help? 1) Save page number and y position. Render the section, then test new page against old. If we're on a new page, jump back to the saved position, insert a page break, then jump to the end. PROBLEM: there doesn't seem to be a way to move the current position to a different page - only to different places on the same page. 2) This seems more sensible: Create the section, but don't render it to the page - render it to some temporary place in memory - a virtual page, effectively (storing the virtual position first and afterwards to get the size of the section). If the section size is more than the distance from the position on the real page to the margin, put a page break on the real page. Then render to the real page - either by copying the contents of the virtual page or by re-rendering that section from scratch. PROBLEM: I can't work out how to do this. doh. Can anyone help, either with these approaches or a better way? thanks max -- Posted via http://www.ruby-forum.com/.