@kumaraswamy.m,
Thanks for your inquiry.
We have tested the scenario using latest version of Aspose.Words for Java 17.8 with following code example. This code example generates document with 1251 pages and takes around 48 seconds. We suggest you please use latest version of Aspose.Words for Java 17.8.
long startTime = System.currentTimeMillis();
Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
for(int i = 0; i < 5000; i++) {
docBuilder.insertHtml("Watermarks are text or pictures that appear behind document text. They often add interest or identify the document status, such as marking a document as a Draft.You can add text watermarks, such as Draft or Confidential, to your document. You can create your own custom watermark such as a company logo.");
docBuilder.insertHtml("When the watermark picture property is set the user is prompted to choose if the image is to be embedded. If the user chooses yes than the image is embedded in the template and the internal image is used. The WordCOMDriver has been updated to use watermarks from both the template as well as from external locations. the watermark is specific to the current section while in the original implementation it was document wide. This means you can have a different watermark per master page the text and picture properties have been merged into a single feature, watermak RPE will create an image watermark if watermark image is not empty. If watermark image is empty it will use the text if not empty added an advanced property window for these properties");
}
docBuilder.insertField("NUMWORDS");
docBuilder.insertField("NUMCHARS");
docBuilder.insertField("NUMPAGES");
doc.updateFields();
docBuilder.insertHtml("<br /><br /><br />");
for (Field field : doc.getRange().getFields())
{
docBuilder.insertHtml("<br />");
docBuilder.insertHtml(field.getFieldCode()+" : "+field.getResult());
}
doc.updateWordCount(true);
long endTime = System.currentTimeMillis();
System.out.println("Total execution time: " + (endTime - startTime) + "ms");