[reportlab-users] drawImage produces blank page only
robin at reportlab.com
Thu Dec 29 12:52:04 EST 2005
Bernd Prager wrote:
> I'm trying to convert an image to a pdf file.
> My test program is very simple:
> 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)
> # main loop
> if __name__ == '__main__':
> 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
> I also tried different image formats (tiff, pbm and jpg).
> Do I do anything wrong?
> Thanks for help,
> -- Bernd
I'm afraid the canvas.Canvas is for PDF only; normally we add images to it.
More information about the reportlab-users