[reportlab-users] Unable to print generated pdf

Robin Becker robin at reportlab.com
Mon Jun 18 06:15:47 EDT 2007


Andrew Kornilov wrote:

> Hello all! I need to print label withc barcode. I wrote code for this:

>

> #!/usr/bin/python

>

> import sys

>

> from reportlab.lib.units import inch

> from reportlab.graphics.barcode.code39 import Standard39

> from reportlab.pdfgen.canvas import Canvas

> from reportlab.lib.styles import getSampleStyleSheet

> from reportlab.platypus import Paragraph, Frame

>

> def run():

> styles = getSampleStyleSheet()

> styleN = styles['Normal']

>

> story = []

>

> string = 'TE.15K035A.SW0001'

>

> barcode = Standard39(string)

> barcode.barHeight = 0.7 * inch

> barcode.lquiet = 0 # left padding

>

> story.append(barcode)

>

> story.append(Paragraph(string, styleN))

>

> out = sys.stdout

> out = 'out.pdf'

>

> c = Canvas(out, pagesize=(162,108))

>

> f = Frame(0, 0, 2.25*inch, 1.5*inch, showBoundary=0)

> f.addFromList(story, c)

>

> c.showPage()

> c.save()

>

> if __name__=='__main__':

> run()

>

> After runnig this code I have pdf. When I see it in pdf viewer - I can see

> proper label with barcode and text. But when I send it to printer - prints

> blank page. Any suggestions

>

.......
your page size is pretty small, but when I print I get the barcode centred in
the middle and it prints fine.
--
Robin Becker


More information about the reportlab-users mailing list