Hi,
I am using the below code from aspose cells jar to convert xls or xlsx to PDF. But I see that the process is hung and there is no exception either.
If I use a direct file, conversion is successful.
Also, I am not able to attach my sample excel file. It says the extension is not authorized
Can someone please help ?
Code:
Workbook workbook = new Workbook(is); //is is inputstream
workbook.save(“C:/temp/ImagetoPDF.pdf”);
return workbook;
Which version of Aspose.Cells for Java API you are using? I tested your scenario/case using our latest version/fix: Aspose.Cells for Java v23.2 (Releases | Maven), it works fine and the output PDF (attached) is fine tuned. Here is the simple sample code that I am using:
e.g. Sample code:
InputStream is = Files.newInputStream(Paths.get("f:\\files\\4030.xlsx"));
Workbook workbook = new Workbook(is); //is is inputstream
workbook.save("f:\\files\\ImagetoPDF.pdf");
We are sorry but we cannot evaluate or test issues with older version. Neither we could include fixes to older versions, the fixes are based on latest APIs set only. So, kindly try using latest version and let us know if you still find any issue.
Hi @amjad.sahi
I see a negative offset error when I try to convert excel to PDF . Stacktrace attached. Please let me know if I am missing something here.
java.io.IOException: Negative seek offset
at java.io.RandomAccessFile.seek(RandomAccessFile.java:555)
at ji.io.RandomAccessFileReadImpl.seekInternal(RandomAccessFileReadImpl.java:47)
at ji.io.jiFileReadAdaptor.seek(jiFileReadAdaptor.java:254)
at ji.io.jiBufferedInputStreamWrapper.skip(jiBufferedInputStreamWrapper.java:284)
at java.io.FilterInputStream.skip(FilterInputStream.java:151)
at com.aspose.cells.b.a.d.zi.g(Unknown Source)
at com.aspose.cells.zjq.b(Unknown Source)
at com.aspose.cells.zjq.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Are you using older version v19.9 or newer version (Aspose.Cells for Java v23.2)? As requested earlier, please try using latest version/fix and in case you still find the issue, kindly do provide your template Excel file (please zip the file prior attaching). We will check your issue soon.