Return to Snippet

Revision: 59419
at September 6, 2012 21:50 by efi


Initial Code
BYTES_TO_READ = 10000 

def go(text):
    doc = SimpleDocTemplate("output.pdf")
    Story = [Spacer(1, 2*inch)]
    style = styles["Normal"]
    p = Paragraph(text, style)
    Story.append(p)
    doc.build(Story)

def get_text_from_file():
    source_file = open("book.txt", "r")
    text = source_file.read(BYTES_TO_READ)
    source_file.close()
    return text

go(get_text_from_file())

Initial URL


Initial Description
So, when I try to set the BYTES_TO_READ variable to more than 200-300 thousands (i.e., just to see what happening, not reading the full book, just some part of it) - it takes HUGE amount of time...

Initial Title
reportlab low performance

Initial Tags


Initial Language
Python