[reportlab-users] eps format file error.

=?gb2312?B?eXV6aG91bGl1MjAwMA==?= yuzhouliu2000 at 163.com
Thu Mar 2 02:19:02 EST 2006


hi :
   I draw a image and lable on a canvs. save to 'pdf','jpg','gif' is ok,but 'eps' is wrong 
and error to me :_PSRenderer instance has no attribute 'drawImage'.how can i draw a Image to 
eps file. Thanks .
   
   code following: 
 
from reportlab.graphics.shapes import Drawing,Image
from reportlab.graphics.shapes import Circle
from reportlab.lib import colors
from reportlab.graphics.charts.textlabels import Label
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import CIDFont
from reportlab.graphics import renderPM,renderPDF,renderPS,renderSVG
def demo():
    dw = Drawing(700, 600)
    Img = Image(30, 30, 640, 500, '10.jpg') # 10.jpg any  a image  
    dw.add(Img)
    lab1 = Label()
    lab1.boxAnchor = 'w'
    lab1.fontSize = 25
    lab1.angle = 0
    lab1.dx = 5
    lab1.dy = 0
    lab1.boxStrokeColor = colors.green
    lab1.boxStrokeWidth = 1
    lab1.setText('Test For Eps File Format')
    lab1.setOrigin(200,560)
    dw.add(lab1)
    dw.add(Circle(50,50, 8, fillColor=colors.green))
    lab2 = Label()
    lab2.boxAnchor = 'w'
    lab2.fontSize = 20
    lab2.angle = 0
    lab2.dx = 10
    lab2.dy = 0
    lab2.boxStrokeColor = colors.green
    lab2.boxStrokeWidth = 0
    lab2.setText('Test For Eps File Format')
    lab2.setOrigin(50,50)
    dw.add(lab2)
    #renderPM.drawToFile(dw, 'test_gif.gif', 'GIF')    
    #renderPM.drawToFile(dw, 'test_jpg.jpg', 'JPG')    
    #renderPM.drawToFile(dw, 'test_png.png', 'PNG')    
    renderPS.drawToFile(dw, 'test_eps.eps','EPS')
    #renderSVG.drawToFile(dw, 'test_svg.svg', 'SVG')
    #renderPDF.drawToFile(dw, 'test_pdf.pdf', 'PDF')
if __name__ == '__main__':
   demo()



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060302/c27e3419/attachment.html


More information about the reportlab-users mailing list