Re: Generate PDF using reportlab and write to s3 bucket without saving locally

2019-04-28 Thread dzulzer
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

Generate PDF using reportlab and write to s3 bucket without saving locally

2019-04-22 Thread Danny Blaker
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,