Free Support Forum - aspose.cloud

ASPOSE java.io.EOFException

Hello,
We are currently converting word documents to PDF with this java code (input is a word file and output is a pdf. We are using the latest library available). The code is very simple:

1046 com.aspose.words.Document srcDoc = new com.aspose.words.Document(input);
1047 srcDoc.save(output);

We run the above code inside of a unix server that in principle is always alive.

The error is apparently when there is a PNG file inside the Word file:

java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:197)
at java.io.DataInputStream.readFully(DataInputStream.java:169)
at com.sun.media.jai.codecimpl.PNGImage.readChunk(PNGImageDecoder.java:550)
at com.sun.media.jai.codecimpl.PNGImage.(PNGImageDecoder.java:441)
at com.sun.media.jai.codecimpl.PNGImageDecoder.decodeAsRenderedImage(PNGImageDecoder.java:74)
at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
at com.sun.media.jai.opimage.PNGRIF.create(PNGRIF.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2242)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2498)
at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546)
at com.aspose.words.internal.zzMB.zzZ(Unknown Source)
at com.aspose.words.internal.zzN0.zzY(Unknown Source)
at com.aspose.words.internal.zzN0.zzZ(Unknown Source)
at com.aspose.words.internal.zzN0.zzY(Unknown Source)
at com.aspose.words.internal.zzYC.zzZ(Unknown Source)
at com.aspose.words.internal.zzYC.(Unknown Source)
at com.aspose.words.internal.zzYC.(Unknown Source)
at com.aspose.words.internal.zzYC.(Unknown Source)
at com.aspose.words.internal.zzU.zzT(Unknown Source)
at com.aspose.words.internal.zzU.zzW(Unknown Source)
at com.aspose.words.internal.zzFA.zzCD(Unknown Source)
at com.aspose.words.internal.zzFA.zzCY(Unknown Source)
at com.aspose.words.internal.zzEH.zzW(Unknown Source)
at com.aspose.words.internal.zzF9.zzZ(Unknown Source)
at com.aspose.words.internal.zzGD.zzW(Unknown Source)
at com.aspose.words.internal.zzGF.endDocument(Unknown Source)
at com.aspose.words.internal.zzEN.endDocument(Unknown Source)
at com.aspose.words.zzZ60.zzZCi(Unknown Source)
at com.aspose.words.zz0D.zzZ(Unknown Source)
at com.aspose.words.zzZGK.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at BeSoftwareDaemon.word_pdf(xxx.java:1047) <-- This is our code
at BeSoftwareDaemon.process_request(xxx.java:414)
at BeSoftwareDaemon.access$200(xxx.java:68)
at BeSoftwareDaemon$1.run(xxx.java:172)

Unfortanly I donĀ“t have the original file, that we use to produce the error.

Thanks in advance for your help.

This topic has been moved to the related forum: https://forum.aspose.com/t/aspose-java-io-eofexception/208688