[reportlab-users] save roomplans as pdf

John J. Lee jjlee at reportlab.com
Wed Sep 20 08:53:39 EDT 2006


[Thomas]
[wants to know how to turn .gif into .pdf]

[Robin]
> from reportlab.pdfgen.canvas import Canvas
>
> c = Canvas('myplan.pdf',pagesize=(myplanwidth,myplanheight))
> c.drawImage('myplan.gif',0,0)
> c.save()
>
> where myplanwidth and myplanheight are the dimensions.

Thomas -- what Robin just demonstrated will give you an bitmap image 
inside a .pdf file that Acrobat reader will happily open and view -- which 
is fine for some purposes.  However, you won't be able to zoom in on the 
plans and have it still look nice, as you can with most PDF files, because 
that "vector" information is simply not there in the .gif file in the 
first place.  If you want a high quality "zoomable" PDF, that's a much 
more tricky conversion.  There are smart programs that will try to convert 
bitmaps to vector formats, but they're obviously not 100% reliable.

Sorry if that's all obvious to you already...


John


More information about the reportlab-users mailing list