[reportlab-users] Reportlab and IronPython

Robin Becker robin at reportlab.com
Wed Sep 15 09:50:02 EDT 2010


I suspect part of your problem may be that you're using latin1 as an encoding
for the python.


We have made an assumption that all the strings we'll see in the print path, ie
things that end up on the pdf canvas, will either be unicode strings or will be
utf8 encoded byte strings. I see the error refers to u'\x93', but I don't think
that's a legal character.

I did try out IronPython some time ago, but at that time I was unable to get it
running. I don't think that was because of any of our extensions though.

It may be that you can do without the extensions as most of the code will run
happily (if a bit slower) without them.

There are three main C extensions,

_rl_accel.pyd which provides fast operations for some of the reportlab internal
operations. If omitted nothing serious should happen.

_renderPM.pyd which implements a canvas like object for drawing charts/lines etc
etc.

sgmlop.pyd an sgml type parser to be used with paragraph tags; if omitted the
paragraph xml may become a bit more xml like ie things like naked ampersands
will not pass without error.

In addition when we use images other than jpg we need to use PIL the Python
Imaging Library to do conversions of various bitmap formats into simple RGB.




On 15/09/2010 13:59, Benoit Dupraz wrote:

> Hello Robin,

>

> I'm writing this mail because I read that you help someone having troubles

> with reportlab like me.

> Here is my story :

>

> I'm a french beginner dev and I would like to use Reporlab under IronPython

> I'm using Reportlab 2.4 for Python 2.6 and IronPython 2.6.

> I've done a basic installation of reportlab (with .exe) as it is explain on

> this page (Prerequisites too..) :

> https://www.reportlab.com/software/installation/

> In order to use Reportlab with IronPython, I'm using ironclad (2.6 or 2.6

> .NET 4.0 Experimental, both have same errors)

> If I try to run this code :

> # -*- coding:Latin-1 -*-

> import ironclad

> import sys

> sys.path.append('C:\\Python26\\DLLs')

> sys.path.append('C:\\Python26\\Lib')

> sys.path.append('C:\\Python26\\Lib\\site-packages')

> import pyRXP

>

> import zlib

> import reportlab

> from reportlab.pdfgen import canvas

> c = canvas.Canvas('test.pdf')

> c.drawString(100,750, "qwertzuiop".encode('ascii'))

> c.save()

>

> Here are the errors : see attached file.

> Do you have a solution to my problem ? I've been searching on the net and I

> read many times that it should works (maybe is there a better way than using

> ironclad...)

>

> Thank you, and I hope you can help me solving this problem

...........
--
Robin Becker


More information about the reportlab-users mailing list