You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
However, when using doc.moveDown() and scrolling to the bottom of the page, PDFKit will not automatically add a new page if you move beyond the area where the current page should fit. This means that the doc.y coordinate you are using is smaller than the bottom edge of the page.
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);
if (doc.y > 595) {
doc.addPage();
}
This way, you will automatically add a new page and prevent texts from spilling out of the page when the doc.y coordinate is greater than the bottom edge of the current page. So your texts will be properly distributed between the pages.
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.
This code results in this. As you can see there is only 1 page and the text is overflowing the page.
How can I automatically make PDFKit add a new page once the space on the current page is finished?
Your environment
The text was updated successfully, but these errors were encountered: