I have a small problem. I recently started using the ReportLab Library in Django. At first I used data with only one line and today I had to create a text file that had more than one line. Then I came across a problem. The problem is that when text is thrown for PDF it does not break the line to the end of the sheet. It just goes from the leaf. How do I set margins and things like that? The code I use is the basics:
def some_view(request):
# Create the HttpResponse object with the appropriate PDF headers.
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"'
# Create the PDF object, using the response object as its "file."
p = canvas.Canvas(response)
# Draw things on the PDF. Here's where the PDF generation happens.
# See the ReportLab documentation for the full list of functionality.
p.drawString(100, 100, "Hello world.Hello world.\nHello world.Hello world.Hello world.Hello world.Hello world.Hello world.Hello world.Hello world.Hello world.Hello world.Hello world.")
# Close the PDF object cleanly, and we're done.
p.showPage()
p.save()
return response