[reportlab-users] Problem with embedded font, help needed

Roberto Alsina ralsina at netmanagers.com.ar
Tue Aug 25 08:28:26 EDT 2009


On Tuesday 25 August 2009 09:22:23 Marius Gedminas wrote:

> It would be interesting.

>

> The first thing that comes into mind is that maybe you're writing the

> contents of the StringIO object into a file object opened in text mode

> on a Windows system, but I'm sure you would notice something like that.


Nope, all Linux all the time here ;-)

Here's the change that "fixed" this (see pdfbuilder.py),

http://code.google.com/p/rst2pdf/source/detail?r=883

and I am pretty sure now the problem is that I am not using StringIO
correctly.

Before I did this:

sio=StringIO('')
[create the PDF in sio]
self.output=unicode(sio.getvalue(),'utf-8','ignore') #This looks fishy!

And here's what now works:

tmpname=tempfile.mktemp()
[create the PDF in tmpname]
self.output=open(tmpname).read()

I am now guessing I am decoding sio.getvalue() to unicode but shouldn't.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)


More information about the reportlab-users mailing list