Ok,
I can't get this to work as I was expeting it to work... All I want is
to get this snippet:
############################################
from reportlab.platypus.doctemplate import SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.enums import TA_CENTER
from reportlab.platypus.paragraph import Paragraph
class RotatedPara(Paragraph):
def draw(self):
self.canv.saveState()
Paragraph.draw(self)
self.canv.restoreState()
style = getSampleStyleSheet()
normal = style["Normal"]
normal.alignment = TA_CENTER
normal.fontName = "Helvetica"
normal.fontSize = 15
pdf = SimpleDocTemplate("notrotatedpara.pdf", pagesize = (250, 80),
rightMargin=5, leftMargin=5, topMargin=10, bottomMargin=5)
story = []
text = "Yet another random foo long text!"
para = RotatedPara(text, normal)
story.append(para)
pdf.build(story)
############################################
to work on the very same way it is right now, but with the result
being a rotated pdf. In other words, the end document will be 80 x 250
instead of 250 x 80.
So inside def draw(self) I have tried to self.canv.rotate(90) and then
to translate it as pointed out by Robin Becker, but I can't get the
same behavior. First of all, I don't really get what happens with the
margins from SimpleDocTemplate when we are dealing with the rotated
paragraph. Second, I can't get the translation to work properly. So
far translate(-125, -40) gave me the best results, but this was
somewhat randomly chosen...
Can anyone help me? Are there any other way around this?
Thanks again,
Jesus