The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
I have two div elements in section element. I would like to change order of those two div elements depending is element in even or odd pages. When I run PDF publish I don't get any errors. Any ideas or workarounds how to do this?
var currentNode = formatting.currentXMLNode;
if (formatting.currentPage.pageNumber % 2 == 0) {
//note! first element in section is title
if (currentNode.childNodes[2]!=null && currentNode.childNodes[1] != null){
currentNode.insertBefore(currentNode.childNodes[2],currentNode.childNodes[1]);
formatting.write(currentNode.nodeName + " Child node1:" + currentNode.childNodes[1].nodeName + " Child node2:" + currentNode.childNodes[2].nodeName);
}
}
Solved! Go to Solution.
My mistake
var currentNode = formatting.currentXMLNode;
if (formatting.currentPage.pageNumber % 2 == 0) {
if (currentNode.childNodes[2]!=null && currentNode.childNodes[1] != null){
var firstDiv=currentNode.childNodes[1];
var seconDiv=firstDiv.augNextSibling;
firstDiv.insertBefore(seconDiv,firstDiv);
}
else
formatting.write("Both are nulls_");
}
My mistake
var currentNode = formatting.currentXMLNode;
if (formatting.currentPage.pageNumber % 2 == 0) {
if (currentNode.childNodes[2]!=null && currentNode.childNodes[1] != null){
var firstDiv=currentNode.childNodes[1];
var seconDiv=firstDiv.augNextSibling;
firstDiv.insertBefore(seconDiv,firstDiv);
}
else
formatting.write("Both are nulls_");
}