def test() :
"""Test this."""
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib import pagesizes
canvas = Canvas("labels.pdf", pagesize=pagesizes.A4)
canvas.setFont("Helvetica", 30)
(width, height) = pagesizes.A4
canvas.drawCentredString(width/2.0, height-4*cm, "Sample LTO labels")
xpos = xorig = 2 * cm
ypos = yorig = 2 * cm
colwidth = 10 * cm
lineheight = 3.9 * cm
count = 1234
BaseLTOLabel("RL", count, "3").drawOn(canvas, xpos, ypos)
ypos += lineheight
count += 1
BaseLTOLabel("RL", count, "3",
border=0.0125).drawOn(canvas, xpos, ypos)
ypos += lineheight
count += 1
VerticalLTOLabel("RL", count, "3").drawOn(canvas, xpos, ypos)
ypos += lineheight
count += 1
VerticalLTOLabel("RL", count, "3",
border=0.0125).drawOn(canvas, xpos, ypos)
ypos += lineheight
count += 1
VerticalLTOLabel("RL", count, "3",
colored=True).drawOn(canvas, xpos, ypos)
ypos += lineheight
count += 1
VerticalLTOLabel("RL", count, "3",
border=0.0125, colored=True).drawOn(canvas, xpos, ypos)
canvas.showPage()
canvas.save()
评论列表
文章目录