[reportlab-users] Bug in SimpleDocTemplate?

Andy Robinson andy at reportlab.com
Thu Feb 1 15:49:37 EST 2007



> So what would someone do if they (like me) are using GhostScript for printing

> rather than Adobe. Does it have such an option? (I don't see one.)

Adobe defines how PDF is supposed to work, not Ghostscript. We can't
make everyone happy so our target is to work with Adobe Reader. I am
quite sure the official Ghostscript newsgroup answer would be "just use
this tiny Postscript macro...." but I prefer Python to Postscript ;-)


> Surely Reportlab should be able to produce output where the document and paper

> match.


There is another option which may help. Try this Canvas method at some
point when drawing the first page, with +90 or -90 degrees:

def setPageRotation(self, rot):
"""Instruct display device that this page is to be rotated"""
assert rot % 90.0 == 0.0, "Rotation must be a multiple of 90
degrees"
self._pageRotation = rot



PDF has an internal option to specify the rotation, and in theory at
least this lets you specify "this is rotated portrait" rather than "this
is landscape". Because Adobe Reader is smart enough to rotate things
for printing, I don't think of the two as different, but they might be.
Also I don't know whether Ghostscript will detect and respect that
parameter, but it should be easy to try.

The other trick you could try is to explicitly call Canvas.rotate(90)
and draw everything thereafter rotated. But this won't work (or would
need some ugly hacks) if using it with Platypus.

Hope this helps.

- Andy


More information about the reportlab-users mailing list