
Expose Python library to PerlScript using WSC
Hi,
I would like to use the ReportLab toolkit ( http://www.*-*-*.com/ )
to produce PDF documents using PerlScript (via WSH). However, this
library is written for Python. I would like to use WSC (and
ActivePython) to expose the ReportLab library to Perl so that we can
take advantage of its features. Sample code follows :
<?xml version="1.0"?>
<component>
<?component error="true" debug="true"?>
<registration
description="ColourTest"
progid="ColourTest.WSC"
version="1.00"
classid="{8991a7a1-25e6-4d7b-9a96-45797114fc3d}"
>
</registration>
<public>
<method name="Canvas"/>
<method name="GetAllNamedColors"/>
</public>
<script language="Python">
<![CDATA[
import reportlab.pdfgen.canvas
from reportlab.lib import colors
from reportlab.lib.units import inch
def Canvas( WScript, Filename ):
WScript.Echo( "Filename : '" + Filename + "'" )
Value = reportlab.pdfgen.canvas.Canvas( Filename )
Value.setFont('Times-BoldItalic', 20)
return Value
def GetAllNamedColors():
return reportlab.lib.colors.getAllNamedColors()
]]>
</script>
</component>
The problem is, when I use the 'Canvas' method, an undefined value is
returned to my PerlScript. But in the above function, the setFont
function works. Can anybody tell me why this is so?