PDFKit page is not automatically added at the end

157 views Asked by At

The PDFKit docs say that "PDFKit automatically inserts new pages as necessary so you don't have to worry about doing that for long pieces of text", does this also apply in cases where we use doc.moveDown() in such a way that it overflows the current page but will generate a new page automatically?

For example, consider the page height as 595 points.

      doc.y = 552
      doc.moveDown();
      doc.text("1", 300)
      doc.moveDown();
      doc.text("2", 300)
      doc.moveDown();
      doc.text("3", 300)
      doc.moveDown();
      doc.text("4", 300)

This code results in this. As you can see there is only 1 page and the text is overflowing the page. enter image description here

How can I automatically make PDFKit add a new page once the space on the current page is finished?

0

There are 0 answers