Added pageBreak div
This commit is contained in:
parent
62506ecc05
commit
aa99728e57
1 changed files with 16 additions and 3 deletions
|
@ -22,6 +22,7 @@ public class DocumentSeparator {
|
|||
private int splitLevel = 0;
|
||||
private boolean splitByPages = false;
|
||||
private int lastSplitPageNum = 1;
|
||||
private Integer pageNumber = null;
|
||||
|
||||
private static LinkedList<Integer> headerStack = new LinkedList<Integer>();
|
||||
private static boolean pageOpened = false;
|
||||
|
@ -149,24 +150,36 @@ public class DocumentSeparator {
|
|||
return hnode;
|
||||
}
|
||||
|
||||
private Node openPageDiv(Node node,int pageNum){
|
||||
private Node openPageDiv(Node node,int curPageNum){
|
||||
if (node == null){
|
||||
System.out.println("Error: node is null on openPageDiv");
|
||||
return node;
|
||||
}
|
||||
if (prevPageNode != null && splitByPages) {
|
||||
arrangePageDivs(node,pageNum);
|
||||
arrangePageDivs(node,curPageNum);
|
||||
}
|
||||
breakPage(node,curPageNum);
|
||||
Document doc = node.getOwnerDocument();
|
||||
Element openBlock = (Element) doc.createElement(DIV);
|
||||
openBlock.setAttribute("class", "pageNum");
|
||||
openBlock.setAttribute("page", Integer.toString(pageNum));
|
||||
openBlock.setAttribute("page", Integer.toString(curPageNum));
|
||||
// insert open section comment before header node
|
||||
node.appendChild((Node)openBlock);
|
||||
node = openBlock;
|
||||
return openBlock;
|
||||
}
|
||||
|
||||
private void breakPage(Node node, int curPageNum) {
|
||||
if (pageNumber != null && pageNumber != curPageNum) {
|
||||
|
||||
Document doc = node.getOwnerDocument();
|
||||
Element pageBreak = (Element) doc.createElement(DIV);
|
||||
pageBreak.setAttribute("class", "pageBreak");
|
||||
node.appendChild(pageBreak);
|
||||
}
|
||||
pageNumber = curPageNum;
|
||||
}
|
||||
|
||||
private void arrangePageDivs(Node node, int pageNum) {
|
||||
Document newdoc = node.getOwnerDocument();
|
||||
Document olddoc = prevPageNode.getOwnerDocument();
|
||||
|
|
Loading…
Add table
Reference in a new issue