[reportlab-users] drawImage produces blank page only

Robin Becker robin at reportlab.com
Thu Dec 29 12:52:04 EST 2005


Bernd Prager wrote:
> 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
......
I'm afraid the canvas.Canvas is for PDF only; normally we add images to it.


-- 
Robin Becker


More information about the reportlab-users mailing list