Free Support Forum - groupdocs.com

NullPointerException when converting PDF to rasterized images


#1

@usman.aziz,
Hello, today my colleague used

PdfDocument pdfDoc = Document.load(PdfDocument.class, bitstreamInputStream);
pdfDoc.addWatermark(watermark);
pdfDoc.rasterize(100, 100, PdfImageConversionFormat.Png);
pdfDoc.save(out);
pdfDoc.close();

to watermark pdf to rasterized images on CentOS 6.5 with JDK 7, and got NullPointerException on

pdfDoc.save(out);

Similar to the previous problem you logged to WATERMARKJAVA-52 , “out” is OutputStream.

But words, powerpoints were watermarked with no problem.
And we haven’t got that issue on development machine Windows 7.

Could it be our CentOS 6.5 misconfiguration or overlooked problem?


This Topic is created by usman.aziz using the Email to Topic plugin.


Possible to add unremovable and invisible watermark using GroupDocs for Java?
#2

@Ecnatneper,

Thanks for posting your inquiry.

Would you please confirm the version of GroupDocs.Watermark for Java you are using? Furthermore, if you are getting this exception for some specific PDF files then please share with us those problematic files. We shall be looking forward to your response.


#3

@usman.aziz,
Thank you, we’re using version 18.8 of GroupDocs.Watermark for Java.


#4

@Ecnatneper,

Thanks for providing the details. Please spare us some time to set up your mentioned environment for the investigation at our end. We shall get back to you shortly.


#5

@Ecnatneper,

Thanks for being patient. We are unable to reproduce your reported issue at our end in CentOS 6.5 with JDK 7 and GroupDocs.Watermark for Java 18.8. We recommend you to please debug your application and check the details of the exception. Furthermore, you may also create a simple console application for testing and check if you are able to replicate the issue in that as well. This will surely help you to locate the issue at your end.


#6

@usman.aziz,
Hello, In the hope of having some clue from yours, I have to bother you again about the problem with rasterizing pdfs with both Jpeg and Png, both ended up with NPE.

I just tried one more time after updating CentOS 6.5 (yum update) required for others tasks, used an pure English pdf contained with tomcat installation (apache-tomcat-7.0.57/webapps/docs/architecture/startup/serverStartup.pdf), still got the NPE, same with those traditional Mongolian pdfs I tried before which was uploaded from other parties I have no contact.

java.lang.NullPointerException
at com.groupdocs.watermark.internal.c.a.pd.dh.c(Unknown Source)
at com.groupdocs.watermark.internal.c.a.pd.dh.b(Unknown Source)
at com.groupdocs.watermark.internal.c.a.pd.c.d(Unknown Source)
at com.groupdocs.watermark.internal.c.a.pd.c.updateAppearances(Unknown Source)
at com.groupdocs.watermark.internal.c.a.pd.dh.b(Unknown Source)
at com.groupdocs.watermark.bt.a(Unknown Source)
at com.groupdocs.watermark.bt.a(Unknown Source)
at com.groupdocs.watermark.ch.a(Unknown Source)
at com.groupdocs.watermark.ch.a(Unknown Source)
at com.groupdocs.watermark.PdfPage.addAnnotationWatermark(Unknown Source)
at com.groupdocs.watermark.PdfPage.addAnnotationWatermark(Unknown Source)
at com.groupdocs.watermark.PdfDocument.uG(Unknown Source)
at com.groupdocs.watermark.Document.vG(Unknown Source)
at com.groupdocs.watermark.Document.save(Unknown Source)
at org.dspace.app.xmlui.cocoon.BitstreamReader.watermark(BitstreamReader.java:919)

I can’t debug from remote currently, I may spare a day or two next Tuesday or Wednesday to remote debug.
And the requirement is to watermark upon clicking the pdfs (download).
I hope the problem could be fixed in early next week.


#7

@Ecnatneper,

Thanks for coming back to us.

Would you please create and share with us a simple standalone console application (source code without compilation errors) that can replicate your scenario and can be used to reproduce the issue at our end? The application could take the input document, add watermark and generate the rasterized PDF in a similar way that you are using in your running application. This will really help us to identify the issue. We shall be looking forward to hearing from you.