title: Python reportlab dynamically create new page after first page is completely filled with text
body: <p>Python 3.8 x64 |  Windows 10 x64 | reportlab v3.5.46 (open-source)</p>
  <p>Been searching everywhere for an answer on this to no avail. I just want to create a PDF document that contains a lot of text. After the first page is completely full of text, the remaining text should flow onto a second page. After the second page is completely full of text, the remaining text should flow onto a third page (and so on)...</p>
  <p>All answers I find searching around the world via the internet states to use the <code>canvas.showPage()</code> method. This is not a great solution because in all of these examples the first page is not completely populated with text hence it is a manual method of adding a new page. In my example I do not know when the first page will be filled with text thus I do not know when I need to create a second or new page using <code>canvas.showPage()</code>.</p>
  <p>I need to somehow detect when the first page cannot hold any more text, and when this occurs create a new page to hold the text which remains.</p>
  <p>From reading over the reportlabs documentation, I am not sure how to achieve this in a practical pythonic implementation. There are also <code>platypus.PageBreak()</code> and <code>BaseDocTemplate.afterPage()</code> methods but not sure what they do because the documentation is sparse on these methods.</p>
  <p>I don't think the code I am using will be much value for my question, but it is included below for reference. The function parameter <code>my_text</code> is a multi-page amount of text.</p>
  <pre><code>from reportlab.pdfgen.canvas import Canvas
  from reportlab.lib.pagesizes import LETTER
  from reportlab.lib.units import inch
  
  
  def create_pdf_report_text_object(my_text):
      canvas = Canvas('Test.pdf', pagesize=LETTER)
      canvas.setFont('Helvetica', size=10)
      text_object = canvas.beginText(x=1 * inch, y=10 * inch)
  
      for line in my_text.splitlines(False):
          text_object.textLine(line.rstrip())
  
      canvas.drawText(text_object)
      canvas.save()
  </code></pre>