[reportlab-users] Damaged pdf file in release mode Compile

Thomas Zehbe tz at ingenion.de
Tue Apr 18 11:06:59 EDT 2006


Am Dienstag, 18. April 2006 16:17 schrieb Robin Becker:
> Thomas Zehbe wrote:
> > Hi All,
> >
...
> > Thanks
> > Thomas
>
> are all your files being opened in binary mode? It would be a good idea to
> split the report code off so you can supply it with data directly into the
> doc generation. So far as I know canvas.save() is OK, but if you're trying
> to do something special with streams etc then binary mode is essential.
Hi Robin,
perhaps I used the wrong words describing my Problem. Talking about "binary 
stream parts" a mean something like that:
...
 /Length 466 >>
stream
*******endstream
...
That's what I found in my pdf files generated by reportlab where the "****" 
mean the binary part I talk of. I do nothing magic with binary data streams. 
My code looks like
...
    pos = []
    pos.append(('Abt','ST', 'Typ', 'Empfänger', 'Abholer', 'fix', 'eben', 
'Maschnr.'))
    for line in cs.fetchall():
        pos.append((abt, st, art, liefname, abholname, termin, eben, masch))
    t = Table(pos, (40,20,60,220,220,60,60,80))
    Story.append(t)
    try:
        doc.build(Story)
    except:
        ...
    if os.name == 'nt':
        os.startfile(docfile)
...
>
> Another way things can go wrong is if two bits of your app are trying to do
> things to the document simultaneously. reportlab is not threadsafe.
I don't think it's a thread problem because the report is called when the user  
selects a menu entry an the call to the python c-api returns after the report 
is genrated. This is the call:
       pValue = PyObject_CallObject(pFunc, pArgs);
After doing the doc.build  I immediately open the file using acrobat using the 
startfile command. Is that ok or do I have to finalize the doc in any way?
Regards
Thomas

-- 
Dipl.-Ing. Thomas Zehbe
INGENION GmbH
Kuhweide 6
31552 Apelern
Fon: 05043 / 40 57 904
Fax: 05043 / 40 57 907


More information about the reportlab-users mailing list