[reportlab-users] drawImage produces blank page only

Bernd Prager bernd at prager.ws
Thu Dec 29 11:05:41 EST 2005


Hi,

I'm trying to convert an image to a pdf file.
My test program is very simple:

#!/usr/bin/python
import sys, Image
from reportlab.pdfgen import canvas

def main():
    im = Image.open('out300.jpg')
    c = canvas.Canvas("pythonJpg.pdf")
    c.pagesize = im.size
    c.pageCompression = 1
    c.verbosity = 0
    c.drawImage('out300.jpg', 0, 0)
    c.showPage()
    c.save()

# main loop
if __name__ == '__main__':
    main()
    sys.exit()

Unfortunately the Adobe PDF reader (I tested version 6 and 7) only
displays and prints an empty page from the generated document.

When I import that document in Photoshop I can actually see the image
though. I don't know what that means, but it seems the pdf file is somehow
broken?

I also tried different image formats (tiff, pbm and jpg).
Do I do anything wrong?

Thanks for help,
-- Bernd



More information about the reportlab-users mailing list