[xhtml2pdf] Support for transparent PNG in pisa_reportlab [Patch included]

1,094 views
Skip to first unread message

lasconic

unread,
May 5, 2010, 12:56:13 PM5/5/10
to Pisa XHTML2PDF Support
Hi,
I use pisa to generate pdf from XHTML. Some images are PNG in in RGBA.
With the 3.0 branch, I got this kind of errors
File "/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfdoc.py",
line 2101, in loadImageFromSRC
raw = im.getRGBData()
File "/usr/lib/python2.5/site-packages/pisa-3.0.32-py2.5.egg/sx/
pisa3/pisa_reportlab.py", line 313, in getRGBData
self._dataA = PmlImageReader(im.split()[3])
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1497, in
split
if self.im.bands == 1:
AttributeError: 'NoneType' object has no attribute 'bands'

After changing line 314 in pisa_reportlab.py to the following it's
working as expected:
if mode == 'RGBA':
if Image.VERSION.startswith('1.1.7'): im.load()
self._dataA = ImageReader(im.split()[3])
im = im.convert('RGB')

Regards,
lasconic

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe Pisa XHTML2PDF Support beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an xhtm...@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an xhtml2pdf+...@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/xhtml2pdf?hl=de, um weitere Optionen zu erhalten.

David Bolton

unread,
Jun 6, 2010, 10:03:38 PM6/6/10
to xhtm...@googlegroups.com
Thank you lasconic.

I filed the bug in the issue tracker
http://code.google.com/p/xhtml2pdf/issues/detail?id=65

David

Reply all
Reply to author
Forward
0 new messages