PDF in java

Hello Team.
I am a licensed user of aspose and used water marking on PDF document. I have used aspose-pdf-18.7.jar file for processing but it is taking too much time in process, Please check the below code-

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(inStream);
com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(watermarkText);

textStamp.setXIndent(120);
textStamp.setYIndent(120);
textStamp.setRotate(com.aspose.pdf.Rotation.None);
textStamp.setRotateAngle(45);

textStamp.getTextState().setFont(new com.aspose.pdf.FontRepository().findFont(“Arial”));
textStamp.getTextState().setFontSize(22.0F);
textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getDarkGray());

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

@praveen043

Thank you for contacting support.

Please upgrade to Aspose.PDF for Java 18.11 and then mention how much time is consumed by the process. Please also share source and generated files so that we may investigate further to help you out.

Dear Team,

We have used the latest Jar files as per your suggestion

Below is the finding-

  1. PPT 7~9.5 mins (aspose-slides-18.11-jdk16.jar)
  2. PDF 7~9.5 mins (aspose-pdf-18.11.jar)
  3. Image 2~3 mins (aspose-imaging-18.11.jar)
  4. Word 1.5~2.5 mins (aspose-words-18.12-jdk16.jar)
  5. Excel 15~45 sec (aspose-cells-18.11.jar)

More than 30 Sec is not acceptable for client, please provide us a valuable options / suggestion.

@praveen043

Thank you for the values.

Please share a narrowed down sample application along with respective files so that we may investigate it in our environment to help you out.

Thanks for your quick reply

First time it’s taking too much time after that it’s working properly .

@praveen043

Please note that necessary resource allocation takes place and Document Object Models are loaded into memory, which makes the first iteration comparitively slower. However, you may share a sample application along with all necessary resources so that we may try to reproduce and investigate it in our environment.