protected boolean performPagination(final LayoutPagebreakHandler layoutPagebreakHandler,
final boolean performOutput)
throws ContentProcessingException
{
// next: perform pagination.
final LogicalPageBox pageBox = getPageBox();
// final long sizeBeforePagination = pageBox.getHeight();
// final LogicalPageBox clone = (LogicalPageBox) pageBox.derive(true);
final PaginationResult pageBreak = paginationStep.performPagebreak(pageBox);
if (pageBreak.isOverflow() || pageBox.isOpen() == false)
{
// final long sizeAfterPagination = pageBox.getHeight();
setLastStateKey(pageBreak.getLastVisibleState());
setPagebreaks(getPagebreaks() + 1);
pageBox.setAllVerticalBreaks(pageBreak.getAllBreaks());
pageCount += 1;
// DebugLog.log("1: **** Start Printing Page: " + pageCount);
debugPrint(pageBox);
// A new page has been started. Recover the page-grid, then restart
// everything from scratch. (We have to recompute, as the pages may
// be different now, due to changed margins or page definitions)
final OutputProcessor outputProcessor = getOutputProcessor();
final long nextOffset = pageBreak.getLastPosition();
final long pageOffset = pageBox.getPageOffset();
if (performOutput)
{
if (outputProcessor.isNeedAlignedPage())
{
final LogicalPageBox box = fillPhysicalPagesStep.compute(pageBox, pageOffset, nextOffset);
outputProcessor.processContent(box);
// DebugLog.log("Processing contents for Page " + pageCount + " Page-Offset: " + pageOffset + " -> " + nextOffset);
}
else
{