[reportlab-users] Inquiry for supported barcode Format

Robin Becker robin at reportlab.com
Fri Aug 23 03:24:13 EDT 2019


Hi Shalin,

probably you should ask these sorts of questions in our users list, but since this is easy I will try and answer directly.

####################################################
def main():
	from reportlab.pdfgen.canvas import Canvas
	from reportlab.lib.pagesizes import letter
	from reportlab.lib.units import inch
	canv = Canvas('shalin-example.pdf', pagesize=letter)
	canv.drawString(inch,canv._pagesize[1]-inch,'This is a string')
	canv.drawImage('pythonpowered.gif', inch*2, canv._pagesize[1]-inch*3)
	canv.showPage()
	canv.save()
if __name__=='__main__':
	main()
####################################################

if you want to know more about the options for drawing directly using the Canvas class you should
look in the code inside the file reportlab/pdfgen/canvas.py.

The drawImage method has the dvantage that if the same image is repeated less storage will be used, but if each image is 
to be used only once then the drawInlineImage method is preferred.
--
Robin Becker


On 22/08/2019 18:37, Patel, Shalin wrote:
> Hi Robin,
> 
> Thank you for letting me know the situation. I'm sure I'll still find some
> workaround, I still have one more question regarding the solution you gave
> me. I'm trying to add the image to the canvas but the problem is I don't
> have anything to set it up in a particular location. I'm using from
> "*reportlab.platypus
> import Image*". And if I still want to set it up at a particular location
> is there any workaround.
> 
> Thank you, once again as you replied even though it is the holiday season.
> 
> 
> Shalin Patel.
> Student(New Jersey Institute of Technology)
.........



More information about the reportlab-users mailing list