[reportlab-users] Custom page lengths

Peter Cock p.j.a.cock at googlemail.com
Tue Apr 12 12:55:51 EDT 2016


On Tue, Apr 12, 2016 at 5:40 PM, Tim Roberts <timr at probo.com> wrote:
> Glenn Linderman wrote:
>>
>> Nearly every device has some sort of PDF viewer; multiple screen size
>> abound.
>>
>> Already coded: formatting the data to different widths so that it is easier
>> to read on various devices from cell phone to tablets, with reasonable font
>> sizes and not needed to scroll sideways.
>
> I need to point out that this is completely contrary to the stated purposes
> of PDF.  A PDF document is supposed to be the same everywhere.  It is not
> supposed to depend on the viewing device.  That's exactly what the "P" is
> for.  What happens when  your phone users try to route their document to a
> printer?  Are they going to get 10 words per page?
>
> I can't help but think that you should be using HTML for this, not PDF.
>

I've done this with ReportLab in order to produce graphs at the same printed
scale where the data changed (e.g. more samples, different window). This
was actually very useful when embedding a small PDF figure in a larger
document (e.g. writing a Scientific paper with LaTeX).

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?

During this work I discovered a 5m by 5m limit in the PDF or Adobe viewer,
even with small fonts and zooming I was pushing the limits of a static
rendering ;)

And yes, P for Portable - this was an effective way to share the graphics
with colleagues and worked very well (this was some years back, SVG
was not a viable option yet).

(Being serious, Tim is making a good point about there being downsides
to preparing custom PDF output for different screen sizes)

Regards,

Peter


More information about the reportlab-users mailing list