We are trying to add watermark to first paragraph of the page. This is working as expected when we run the code in MAC but when we run the same code in Cent OS we are seeing watermark of one page is getting overlapped in another page.
Attached the sample files and outputs from MAC and CentOS.
Our code will be some thing like as below
for (Section section : doc.getSections()) {
NodeCollection paragraphs = section.getBody().getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph para : paragraphs) {
if (collector.getStartPageIndex(para) == pageIndex && para.getAncestor(NodeType.TABLE) == null) {
// watermark object creation code here.
// we set below properties
watermark.setAnchorLocked(true);
watermark.setAspectRatioLocked(true);
watermark.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
watermark.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
watermark.setHorizontalAlignment(HorizontalAlignment.RIGHT);
if (newNode) {
para.appendChild(watermark);
pageIndex++;
}
}
}
Files.zip (3.2 MB)
SampleTestMultiplePage_CentOS.docx has 2 watermarks in second page but no watermark in 3rd page. We need to drag second page watermark to side to other watermark visible .
Similar thing for the 6th page has 2 watermarks but no watermark on 10th page. Where as MAC has the watermark in expected way.
SampleTestPage1.docx has two watermarks on first page. But we could see watermark on all pages as well. MAC does not have this issue.
All the output files and sample files are attached
Overlapped watermark when moved is visible shown in below screenshot
Screen Shot 2020-04-11 at 5.07.43 PM.png (276.7 KB)