Figured it out: streams have this builtin position attr which bytesIO uses
to keep track of to know where to insert data. Reportlab simpledoctemplate
writes to the stream object, but when it completes pdf generation at
doc.build(story), it doesn't reset the stream position back to the
beginning
I'm trying to generate a PDF using reportlab and write to s3 bucket without
saving locally
I know I'm missing something simple:
# create a stream
stream = io.BytesIO()
# generate PDF
doc = SimpleDocTemplate(stream, pagesize=letter,
rightMargin=72, leftMargin=72,
2 matches
Mail list logo