[reportlab-users] windows platypus problem

Tim Roberts timr at probo.com
Mon Aug 29 12:47:24 EDT 2005


On Fri, 26 Aug 2005 19:42:59 +0300, Andrey Khavryuchenko 
<akhavr at kds.com.ua> wrote:

>I'm trying to use platypus to handle my pdf output using custom TTF fonts.
>But the pdf I get is empty (nothing is shown).
>
>The same script under linux (with font path adjusted) works flawlesly.
>
>What I'm doing wrong?
>  
>

The symptom (different behavior under Windows and Linux) should have 
been a big clue.  Compressed PDF files contain binary data, but you're 
not opening the file in binary mode.  The data get trashed, and Acrobat 
can't read it.  Change this:

    open('t.pdf','w').write(fp.getvalue())

to this:

    open('t.pdf','wb').write(fp.getvalue())

and all will be well.  Is there a reason you are going via a StringIO 
instead of straight to the file?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list