Reputation: 753
Background
I've a document that I build up throu various steps.
In one of these steps I add content to a Document from a chapter structure I've built containing the content.
This part in particular is very simple. It simply adds the content to the document.
Sometimes my structure specifies there should be a page break, and thus document.NewPage(); gets executed. This works, usually.
We are using ITextSharp version 5.3.2.0. ( A few month old or so)
The problem
When document.NewPage() get's executed and is very close to the end of the document or perhaps just entered a new page I am guessing, I get an empty page with the rest of my content being added on the following page.
Only having the Document to work with at this point I can not seem to find a way how to determine if document.NewPage() should be skipped or not to work around this bug or issue.
Thanks
Upvotes: 3
Views: 4621
Reputation: 77606
This can be caused by three things:
onStartPage()
method.writer.setPageEmpty(false);
which is kind of asking iText to consider an empty page as not being empty.In all other cases, the newPage() method is ignored if you're currently on a page that doesn't have any content.
Upvotes: 3