Free Support Forum - aspose.com

Insert text at the end of all pages

Hi guys,

I need to insert a text at the end of the each page of my document. What I’m doing is:

final com.aspose.words.DocumentBuilder builder = new com.aspose.words.DocumentBuilder(document);
for (Section sect : document.getSections()) {
final Paragraph lastPara = sect.getBody().getLastParagraph();
final Paragraph newPara = builder.insertParagraph();
final Run run = new Run(document, WATERMARK_TEXT);
final Font f = run.getFont();
f.setName(“Arial”);
f.setSize(16);
f.setBold(true);
newPara.getRuns().add(run);
lastPara.getParentNode().insertAfter(newPara, lastPara);

However, the result document is wrong. I’ve attached the input and the output documents.

Best Regards,Documents.zip (17.1 KB)

@fcri,

Please use the codes mentioned in the following article to meet this requirement:
Working with Watermark

Hi,

I can not log in. I use the same login on this forum but it says that is incorrect.

@fcri,

Please use the following link:

https://docs.aspose.com/display/wordsjava/Working+with+Watermark

We apologize for your inconvenience.