Aspose PDF textstamp code

com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(“Confidential”);

This code take too much time to execute. Please support.

@praveen043

Thank you for contacting support.

Would you please share source and generated files along with narrowed down code snippet so that we may try to reproduce and investigate it in our environment. Please also mention the time consumed during the process. Before sharing requested data, please ensure using Aspose.PDF for Java 18.10.2 in your environment.

Please find the below source code and attached file in which we are using water markcollections.pdf (62.0 KB)

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(inStream);
com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(“Confidential”);
textStamp.setXIndent(100);
textStamp.setYIndent(100);
textStamp.setRotate(com.aspose.pdf.Rotation.on90);
textStamp.getTextState().setFont(new com.aspose.pdf.FontRepository().findFont(“Arial”));
textStamp.getTextState().setFontSize(14.0F);
textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGreen());

for (int Page_counter = 1; Page_counter <= pdfDocument.getPages().size(); Page_counter++) {
pdfDocument.getPages().get_Item(Page_counter).addStamp(textStamp);
}
pdfDocument.save(path + fileName);

At every class calling it’s taking too much time why?

// Initialize License Instance
com.aspose.pdf.License license = new com.aspose.pdf.License();

@praveen043

We have tested the code snippet and it takes approximately 10 seconds to watermark all pages in shared PDF document. Would you please mention your environment details while mentioning the time consumed during this process on your end.