Free Support Forum -

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.


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.getTextState().setFont(new com.aspose.pdf.FontRepository().findFont(“Arial”));

for (int Page_counter = 1; Page_counter <= pdfDocument.getPages().size(); Page_counter++) {
} + 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();


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.