We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells Java PDF Conversion Document Properties Stuck

When I use Cells to convert to PDF I am not seeing the correct version of cells used in the pdf document properties. It seems to be stuck at 17.4.0. I have tried using multiple different jars and even logged version which conflicts with this information. Any help on this appreciated.

Tom

@apose_user_tnr,

I did test using latest version/fix: Aspose.Cells for Java v18.8.x, it works fine and when I checked the PDF Producer field for the output PDF file by opening Document properties dialog (in Adobe Acrobat), it correctly shows the version. Please try our latest version/fix: Aspose.Cells for Java v18.8.x and in case you still find the issue, kindly do provide your template file and output PDF file using v18.8, we will check it soon.

Wow. That is crazy. I just downloaded latest verions and tried this. 18.8. I am running this in Windows 10 Oracle Jdeveloper in debug mode. When I print out the current version during conversion it gives me 18.8. However, after I save it into a database blob and down load it has the 17.4. I wonder if something is cached somehow ?

@apose_user_tnr,

You can try to remove the JAR file of Aspose.Cells API and then add it again after clean and build your project, or may be refresh the database. Hopefully the version information will be fixed.

So I think I am zeroing in on the issue I am having. I created a small java application to read a local excel file from disk and write pdf to disk. This worked successfully with 18.8 version and the product version was correct in the PDF.
Next I created a new application and took the logic from the application having problem and transferred to new application. The main difference in this application is the data source is read in from database blobs and constructed using streams in java. My Excel object is instantiated using stream and written back to the database as a PDF using a stream. This still showed the problem of 17.4 in the PDF version. I put a write to local disk after the stream conversion write and this was CORRECTLY generated. I think there may be a problem with the stream PDF write in CELLS module. Please let me know what you think.

Thanks,
Tom

So I think I am zeroing in on the issue I am having. I created a small java application to read a local excel file from disk and write pdf to disk. This worked successfully with 18.8 version and the product version was correct in the PDF.
Next I created a new application and took the logic from the application having problem and transferred to new application. The main difference in this application is the data source is read in from database blobs and constructed using streams in java. My Excel object is instantiated using stream and written back to the database as a PDF using a stream. This still showed the problem of 17.4 in the PDF version. I put a write to local disk after the stream conversion write and this was CORRECTLY generated. I think there may be a problem with the stream PDF write in CELLS module. Please let me know what you think.

Thanks,
Tom

@apose_user_tnr,

I am unable to notice any difference while saving it to disk or a stream. Please create a narrowed down project for testing. We will reproduce the problem and provide our feedback after analysis.

Thanks. That is exactly what I did to find this situation. Basically reads blob from oracle db into byte stream to instantiate workbook object. Then I just save converted PDF stream to blob in oracle db and dump to local file. Blob pdf is different than local pdf. Very simple java application.

@apose_user_tnr,

I have tried following sample code where blob data is simulated however still issue is not re-produced. Please review this code and modify it if it is not according to your requirements. If required please share some source blob data in a file for our testing as well.

//Create workbook using Aspose.Cells for Java 18.8.4
Workbook wb = new Workbook();

//Save it on disc
wb.save(path + "template.xlsx");

//
File file = new File(path + "template.xlsx");

// Following is blob which is read from database (say)
byte[] fileContent = Files.readAllBytes(file.toPath());

FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.read(fileContent);

//Now workbook is initiated from the input stream which is created using sample blob
LoadOptions loadOptions = new LoadOptions();
wb = new Workbook(fileInputStream, loadOptions);
wb.save(path + "output.xlsx");


//This workbook is saved into memory stream
FileOutputStream stream = new FileOutputStream(path + "output.pdf");
wb.save(stream, new PdfSaveOptions(FileFormatType.PDF));

Thanks. On Tuesday I will try on my system and or modify,
Tom

@apose_user_tnr,

You are welcome.

Workbook ExcelDocument ;
IinputStream DocumentStream;
ExcelDocument = new com.aspose.cells.Workbook(DocumentStream, opts);
Converted_outputStream = new ByteArrayOutputStream();
ExcelDocument .save(Converted_outputStream , opts); I think stream is still good here because I can dump stream to file OK.
retval = outputDatabase( connect_db, Converted_outputStream); Here is where problem is occurring routine

----Output
public Integer outputDatabase( Connection conndb, ByteArrayOutputStream outputStream){
cmdString = “insert in doc_table (BLOB_CONTENT) values (?)”;
statement = connect_db.prepareStatement(cmdString);
statement.setBlob(1, new ByteArrayInputStream(outputStream.toByteArray()));
statement.execute();
statement.close();
return 1;
}

So this is not a working copy but example of what I am doing. Everything in the stream work until the write to the database which is successful but the Fonts are wrong “Tibetan_Machine_Uni”. I don’t know why and the PDF Producer is Aspose.Cells for Java v17.4.0 but I am using 18.8.0. If I save that stream to the local disk everything is good. I guess my issue revolves around the write the blob in the Prepare Statement. Do I need to set anything else ? I am able to use this methodology to convert Word, Powerpoint just fine. I use the same output (write to blob database) for the Word, Cells, and Slides. Hopefully you can see something related to fonts ??? Thanks for all your help.

Tom

@apose_user_tnr,

We have tried to re-produce this issue but still not succeeded. You may please send us following data:

I think stream is still good here because I can dump stream to file OK. (Comments in above code)

At this line save the byte array data (which you save in database as blob) into some file and share here. Please note that send us byte array data, not the PDF file.

  1. At the same line above where you mentioned that if you dump it in file and it is ok, send us the output PDF file.

Here is where problem is occurring routine (Comments in your code)

When you read blob data from database, save this blob data (byte array)directly into file without any conversion and send us

  1. After fetching data when you save it again as PDF, send that PDF file to us.

So simply we need your blob data before saving into database and after fetching from database without any change by Aspose.Cells and both PDF files generated from these blob data.

Thanks for reply. I am not sure how I am going to accomplish delivery of the data because of the system classification it resides. Any other thoughts for debugging problem ? Any thing I can print out using existing APi methods on java console ?

Is there any type of designation in class files which identifies the version of the aspose cells conversion ? How is this version placed in the converted PDF ? What jar class is used ?

Thanks,
Tom

@apose_user_tnr,

You may please try to provide us blob data of some empty sample Excel file as we do not need Excel file with some data. We just want to analyze the blob data before saving and after fetching from database.

Regarding your query about jar classes, we will provide our feedback later

Today I tested the cells to PDF conversion again. This time I used a “new empty spreadsheet XSLX” , a new simple Spreadsheet XLS, and new simple spreadsheet XLSX. All of these files, when written to blob using code I showed, have a PDF version of v17.4.0 and have missing fonts but loaded with Tibetan_Machine_Uni. I also wrote these same PDF using output filestream of the same Workbook object to local drive after writing to blob. All of these files on the local drive where “properly constructed” with the correct Fonts and contained PDF version v18.8.0. This is not specific to any particular XLS or XLSX file I load. It is “ALL” XLS and XSLX files I try to convert to PDF and stick a byte stream and write into a BLOB. I don’t really think this has to do with the contents of the file but something associated with a api conversion method. Appreciate any support, ideas, insight, or utilities you could provide to help diagnose. This conversion process is a critical aspect of our systems.
As a side note which is relative, we convert Word documents using the same stream write to blob routine for Word, Excel, and Powerpoint. The Word and Powerpoint conversions write out properly to blob and contain PDF version V18.8.0. I think this points to problem in the cells jar.
Thanks,
Tom

@apose_user_tnr,

We were able to understand the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42718 - PDF file created by Aspose.Cells shows "PDF Producer is Aspose.Cells for Java v17.4.0" after writing and reading PDF in database as BLOB

Thank YOU :slight_smile:

@apose_user_tnr,

You are welcome.