0

I'm using pdfbox-layout to create and manage PDF documents using Document API.

Document document = new Document();

It manages to create new page automatically if the text size increases beyond current page using Paragraph API.

Paragraph paragraph = new Paragraph();

However, I'm unable to add new page manually as and when needed. I want to print some content starting from new page.

ScrapCode
  • 2,109
  • 5
  • 24
  • 44

1 Answers1

0

After going through the API's source code, I found that add method accepts parameter of type Element,

document.add(Element element)

And after inspecting all the classes that implements Element interface, I found the one that I need, i.e. ControlElement

So, to add a new page, my code looks like,

document.add(ControlElement.NEWPAGE);
ScrapCode
  • 2,109
  • 5
  • 24
  • 44