[reportlab-users] what's wrong with this renderPM code?
Matthew Wilson
reportlab-users@reportlab.com
Fri, 23 Jan 2004 15:37:07 -0500
Hi -
I want to use reportlab graphics to make some web-viewable charts. I
tried this code and it fails:
#! /usr/bin/env python
import reportlab
from reportlab.lib import colors
from reportlab.graphics.shapes import *
d = Drawing(400,200)
d.add(Rect(50,50,300,100, fillColor=colors.yellow))
from reportlab.graphics import renderPM
renderPM.drawToFile(d, 'out.jpg', 'JPG')
This is the error I get:
[d1wmw01@d135linuxserver public_html]$ python rlfun.py
Warn: Can't find .pfb for face 'Times-Roman'
Traceback (most recent call last):
File "rlfun.py", line 12, in ?
renderPM.drawToFile(d, 'out.jpg', 'JPG')
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
541, in drawToFile
c = drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL,
showBoundary=showBoundary)
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
527, in drawToPMCanvas
draw(d, c, 0, 0)
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
50, in draw
R.draw(drawing, canvas, x, y)
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
96, in draw
self.applyState()
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
81, in applyState
self._canvas.setFont(s['fontName'], s['fontSize'])
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
349, in setFont
_setFont(self._gs,fontName,fontSize)
File "/usr/local/python-modules/reportlab/graphics/renderPM.py", line
232, in _setFont
raise RenderPMError, "Can't setFont(%s) missing the T1
files?\nOriginally %s: %s" % (fontName,s1,s2)
reportlab.graphics.renderPM.RenderPMError: Can't setFont(Times-Roman)
missing the T1 files?
Originally exceptions.TypeError: makeT1Font() argument 2 must be string,
not None
What am I doing wrong?
Thanks for the help.
Matt
--
My public key:
gpg --recv-keys --keyserver www.mandrakesecure.net 0x8D10BFD5