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.


#10

Please find the steps in attached document.Error Screen_20180716.zip (192.8 KB)


#11

Dear team please provide the quick response regarding that. There are too much time passed.


#12

@praveen043

Thank you for elaborating it further.

We have managed to reproduce the problem in our environment. There appeared some FileNotFoundExceptions and we had to create folders and PDF file based on the file paths specified in your application. However, the reason for this problem is still unclear. Therefore, we need the source code instead of deployed version of your application to investigate and sort it out.


#13

spring3-mvc-maven-xml-hello-world.zip (74.1 KB)

Please find the attached source code.


#14

@praveen043

Thank you for sharing requested data.

We have investigated the project shared by you and have noticed that there is no dependency declared for Aspose.PDF for Java 18.7 API in pom.xml file of your web application. Please ensure declaring dependency of Aspose.PDF and then share your kind feedback with us.

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-pdf</artifactId>
    <version>18.7</version>
    <type>jar</type>
</dependency>

Your application is working fine as we have tested with a blank PDF document and generated PDF file has been attached for your kind reference TextStamp_output.pdf. We hope this will be helpful. Please feel free to contact us if you need any further assistance.


#15

Error is coming please check the attached screen.Error_aspose.png (76.9 KB)


#16

@praveen043

You may try to resolve the dependencies by building the project, or you can also locally install the artifacts by downloading JAR file of Aspose.PDF for Java API from the link we have already shared with you. We have uploaded the working version of project with all dependencies resolved and you can download it from this Google Drive link and then share your kind feedback with us.


#17

Capture.PNG (22.0 KB)

Problem occurs during downloading.


#18

@praveen043

The problem can occur because of some internet issues. Please ensure stable internet connection and try again because the file is downloading fine.


#19

Now it’s working. But added watermark only 4 pages.
Is it restriction at trial version or anything wrong in logic.


#20

@praveen043,

Thank you for your kind feedback.

We are glad to know that your issue has been resolved. Moreover, you are facing evaluation limitations as explained over Evaluation Version Limitations.


#21

A post was split to a new topic: Questions about Aspose Total for .NET/Java and both