Ejemplo n.º 1
0
 def testWedge(self):
     s = shapes.Wedge(0, 0, 10, 0, 90)
     assert s.getBounds() == (
         0, 0, 10, 10), 'expected (0,0,10,10) got %s' % repr(s.getBounds())
Ejemplo n.º 2
0
# Option two: background from a ReportLab image.
# Note we just load it from file, but you could do something fancier...
# The size parameters don't matter as pylabels will scale it to fit the page.
specs = labels.Specification(210,
                             297,
                             2,
                             8,
                             90,
                             25,
                             corner_radius=2,
                             background_image=shapes.Image(
                                 0, 0, 750, 1055, file2))
process_sheet(specs, "page_background_image.pdf")

# Option three: use a ReportLab drawing.
# Again, this will be automatically scaled so choose the size to suit you.
# Using the size of the page sounds like a sensible option.
bg = shapes.Drawing(width=210.5, height=297)
bg.add(shapes.String(105, 50, "My cool background", textAnchor="middle"))
bg.add(shapes.Wedge(10, 155, 95, 30, 90, fillColor=colors.green))
specs = labels.Specification(210,
                             297,
                             2,
                             8,
                             90,
                             25,
                             corner_radius=2,
                             background_image=bg)
process_sheet(specs, "page_background_drawing.pdf")