com.aspose.pdf.facades.PdfFileStamp


#1

For evaluating your tool, we have configure the PDF watermarking functionality.
At runtime, we are getting some following error.
Please support for the same

SEVERE [http-nio-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [Spring MVC Dispatcher Servlet] in context with path [/applicationname] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/aspose/pdf/facades/PdfFileStamp] with root cause
java.lang.ClassNotFoundException: com.aspose.pdf.facades.PdfFileStamp
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147)


#2

@praveen043,

Please send us your source PDF document and the complete code. We will investigate your scenario in our environment, and share our findings with you. Your response is awaited.


#3

public static void insertWatermarkPdf(String path, String fileName, String watermarkText) {

	PdfFileStamp fileStamp = new PdfFileStamp();

	fileStamp.bindPdf(path+fileName);

	FormattedText formattedText = new FormattedText(watermarkText, java.awt.Color.GRAY, java.awt.Color.WHITE, FontStyle.Helvetica, EncodingType.Winansi, false, 50);

	fileStamp.setStartingNumber(1);

	Stamp stamp = new Stamp();
	stamp.bindLogo(formattedText);
	stamp.setRotation(52f);
	stamp.setBackground(Boolean.FALSE);
	stamp.setOpacity(.4f);
	System.out.println(fileStamp.getPageWidth()+"<<>>"+fileStamp.getPageHeight());
	stamp.setOrigin((fileStamp.getPageWidth()-630)/2, (fileStamp.getPageHeight()-630)/2);
	fileStamp.addStamp(stamp);

	fileStamp.save(path+"confidentieldata\\"+fileName);
	fileStamp.close();
}<a class="attachment" href="/uploads/discourse_instance3/16170">angularjs_tutorial.pdf</a> (1.7 MB)

#4

@praveen043,

We have tested your scenario with the latest version 18.5 of Aspose.PDF for Java API, and could generate the output PDF without any error. This is the output PDF: Output.pdf (1.7 MB). Please make sure that you have added the reference of Aspose.PDF for Java API in your application project, and also try with the latest version 18.5.


#5

This code is working fine by executing main method. But when we run the same using Tomcat application server (with Spring MVC framework) it’s giving error, which I have mentioned at first time in forum.
Please check the same as per given mentioned scenario.


#7

@praveen043,

We have tested your scenario in our Tomcat environment with the latest version 18.6 of Aspose.PDF for Java API, and the code works fine. This is the output PDF: angularjs_Output18.6.pdf (1.7 MB). Please create a small project application, which reproduces this error in your environment, and then send us a ZIP of this project. We will investigate your scenario in our environment, and share our findings with you.


#8

Please find the attached source related to spring3-mvc-maven-xml-hello-world.zip (4.4 MB)


#9

@praveen043

Thank you for sharing requested data.

Would you please mention the steps to reproduce the problem you are facing in your environment. Please also mention which among attached files contains the code snippet related to Aspose.PDF API so that we may proceed to help you out.