[reportlab-users] Custom page lengths

Robin Becker robin at reportlab.com
Wed Apr 13 09:52:04 EDT 2016

On 13/04/2016 00:40, Glenn Linderman wrote:
> On 4/12/2016 9:55 AM, Peter Cock via reportlab-users wrote:
>> Essentially I just set the page size based on the data - knowing how the
>> graph would be constructed and therefore how much space I needed.
>> However, I was using drawing primitives etc so this may not make sense
>> in your context Glenn?
> I'm (presently) using flowables... and don't know the overall length of the page
> before I start, it partly depends on the actual textual content.
> One thought I had was to generate the document once, "somehow" gather statistics
> from the Page Breaks about the length of the page content, and then generate it
> again, knowing the needed page sizes.
The page size is actually dynamically adjustable in Canvas.showPage, there we 
check the user given size and dynamically modify the PDF page size to allow for 
cropmarks and exotics.

My guess is, you could dynamically change canvas page height in a derived 
class's showPage if you can push the needed size onto the canvas in an endOfPage 
Robin Becker

More information about the reportlab-users mailing list