in django project trying create pdf using python-reportlab
reportlab.pdfgen import canvas response = httpresponse(content_type='application/pdf') response['content-disposition'] = 'attachment; filename="somefilename.pdf"' p = canvas.canvas(response) p.drawstring(10, 800, "name") p.drawstring(10, 900, "address") p.drawstring(10, 1000, "school") p.showpage() p.save()
on output pdf shows name
, happened other 2 strings ?
the coordinates "address" , "school" outside of page. origin of reportlab coordinate system bottom-left, x coordinate going right , y coordinate going up. try following instead:
p.drawstring(10, 800, "name") p.drawstring(10, 790, "address") p.drawstring(10, 780, "school")
Comments
Post a Comment