#!/usr/bin/env python
# -*- coding = utf-8 -*
#一个简单的ReportLab程序
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics import renderPDF
d = Drawing(100, 100)#Drawing生成一个给定大小的图纸
#创建带有某些属性的图形元素,本例是一个String对象它的主要参数是x y的坐标以及要显示的文本,
#还可以提供各种特性
s = String(50, 50, 'Hello, World!', textAnchor='middle',Color = 'blue')#textAnchor可选值为start middle end
d.add(s)#将元素添加到图纸中去
# -*- coding = utf-8 -*
#一个简单的ReportLab程序
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics import renderPDF
d = Drawing(100, 100)#Drawing生成一个给定大小的图纸
#创建带有某些属性的图形元素,本例是一个String对象它的主要参数是x y的坐标以及要显示的文本,
#还可以提供各种特性
s = String(50, 50, 'Hello, World!', textAnchor='middle',Color = 'blue')#textAnchor可选值为start middle end
d.add(s)#将元素添加到图纸中去
renderPDF.drawToFile(d, '/home/buntu/py5/items21.pdf', 'A simple PDF dile')
# renderPDF.drawToFile的调用会把你的PDF文件存到你指定的目录中
#函数文档介绍 drawToFile(d, fn, msg='', showBoundary=<reportlab.rl_config._unset_ object at 0x7f3bd5f01470>, autoSize=1)