public void pageBreak() { if (breakHandlingParent != null) { if (sectionParent.getHeightLimit() >= 0.0f) { // fill remaining space on page break fillTable(sectionParent.getHeightLimit()); } // flush flushTable(); breakHandlingParent.columnBreak(); } else { // more column breaks than available columns // but we cannot break to a new page // don't really know what to do in such situation // anyway it is logical error made by document creator setColIdx(colIdx + 1); } }
private void simulateText() { float maxHeight = sectionParent.getHeightLimit(); List<ColumnText> splittedTexts = fillTable(maxHeight); if (splittedTexts == null) { // fits in current column on page if (balanceText) { float minHeight = 0f; if (maxHeight < 0.0f) { maxHeight = layoutTable.calculateHeights(); } float currHeight = 0.0f; while (Math.abs(maxHeight - minHeight) > 0.1f) { currHeight = (minHeight + maxHeight) / 2; if (fillTable(currHeight) == null) { // try to lower height maxHeight = currHeight; } else { // have to raise height minHeight = currHeight; } } // populate table with last height if (currHeight != maxHeight) { fillTable(maxHeight); } } else { if (maxHeight >= 0.0f) { // fill minimum space only fillTable(-1.0f); } } } else { // overflow if (breakHandlingParent != null) { flushTable(); breakHandlingParent.columnBreak(); // texts = splittedTexts; colIdx = texts.size() - 1; simulateText(); } } }