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

Free Support Forum - aspose.com

Delete residue files

Hi,

I have been using Aspose.cells.jar for conversion of a .xls file to .pdf file.
If the .xls file contains a few images, then the conversion creates image files for all the images contained in the xls file on the hard-disk. One more intermediate file named name.xls.xml is created
The pdf file is created successfully.
However, the issue is the residue files just stay there. I have to write another file deletion utility which deletes the residue files after the conversion which at-times is not able to cleanup completely as the files may be in use by the conversion threads.

Can you please take the responsibility of cleaning up and deleting all the intermediate files that were created during conversion?

Thanks,
Suprita

Hi Suprita,

We also provide direct conversion approach to convert Excel files to PDF format directly using only Aspose.Cells for Java component.

Please try this approach for your need. For reference, please see the document:
Convert Spreadsheet to PDF using Aspose.Cells

I have also attached the latest version/fix of the product here so you may try it.


Thank you.

Hi Amjad,

The way that you suggested doesnt create the intermediate xml file. However, for the case that I am stating, can you please try converting a xls file which contains a few pictures and images, to pdf file.
You would notice that all the images that are contained in the xls file are actually getting stored on hard-disk while conversion and not even deleted automatically.
The cleanup becomes the user’s responsibility.

Please look into this.

Thanks,
Suprita

Oops, I was trying with 2.3.0 version.
Now I tried with the Aspose.cells for 2.3.1.6 version (the jar that you had provided)

The pdf that is generated from my xls file seems to be corrupted.
I have attached my xls file, the output pdf file and also the code for conversion.

Please let me know the next steps.

Thanks,
Suprita

Hi Suprita,

To use the direct xls2pdf feature, please use file format FileFormatType.PDF instead of FileFormatType.ASPOSE_PDF.

FileFormatType.ASPOSE_PDF file format will create a mediate xml file and related source files(such as image files) and with those mediate files user can create pdf file using Aspose.Pdf for Java. Because those mediate files will be used by Aspose.Pdf for Java to create pdf file, so we cannot delete them automatically.

It is recommended for users to use the new direct xls2pdf feature of Aspose.Cells for Java. For the file format FileFormatType.ASPOSE_PDF, that is, to create pdf by intermediate files using both Aspose.Cells and Aspose.Pdf, will be deprecated in later versions.

Thanks,

Hi,

The suggested change works on windows but on solaris it is giving me a long list of exceptions and the following stacktrace repeats for a while:

java.lang.NullPointerException
at com.aspose.cells.a.a.d.w.(Unknown Source)
at com.aspose.cells.a.a.d.K.(Unknown Source)
at com.aspose.cells.a.a.d.w.a(Unknown Source)
at com.aspose.cells.a.a.d.J.a(Unknown Source)
at com.aspose.cells.a.a.d.N.a(Unknown Source)
at com.aspose.cells.a.a.d.g.a(Unknown Source)
at com.aspose.cells.a.a.d.d.a(Unknown Source)
at com.aspose.cells.a.a.a.i.a(Unknown Source)
at com.aspose.cells.a.a.a.e.a(Unknown Source)
at com.aspose.cells.a.a.a.n.a(Unknown Source)
at com.aspose.cells.a.a.i.r.a(Unknown Source)
at com.aspose.cells.a.a.d.d.a(Unknown Source)
at com.aspose.cells.a.a.i.w.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at com.unica.thumnailgenerator.ConvertXLSToPDF.convert(ConvertXLSToPDF.java:22)

Please let me know what can be done about this.

I have attached my code and the sample XLS file with this post.

Thanks,
Suprita

Any updates?

Anyone looking at this post? The issue is a bit urgent.
Can someone please take this up and let me know the resolution

Hi Suprita,

We have tested your case. If no path has been set for the fonts, the code generates the same exception. When the required font files were copied in to the Linux and set the option to point to that font path eliminates the exception and generates the PDF successfully.

Workbook.getSaveOption().setFontPath(String[] arrFontPath)

Please try this option. If still there is any issue, forward it to us.

Thanks,

Hi suprita,

In some situations the resultant PDF file looks much more different from the original Excel file. To make the result same like Excel, we have to use the same fonts as of Excel. So, we must know where to find those fonts which are used in Excel.

You can find Fonts on various locations in different environments. It differs with respect to operating system. In your situation as a workaround, you can just copy the font files from Windows operating system to Solaris operating system and then set that path as FontPath to create PDF.

We will investigate this issue further that if fonts cannot be found on the path then what the alternative to use by default is.

Thanks,

Salman,

This giving the right font folder has been an issue with Aspose.words as well… This is like a nightmare for me now. Can you please give me a java utility which can find all the font folders, to start with can you give me for solaris platform.
That would be great help.
Otherwise can you give me a workaround where the conversion of XLS to PDF just uses the default fonts which are available with JDK. I am not much concerned about maintaining the fonts during conversion, generating a file with data and format is more important for me.

It would be great if we can solve this issue quickly.

Thanks,
Suprita

Hi Suprita,

Our team is working on this, we are trying our best to implement this feature. It may take up to 3 weeks to develop and test this enhancement. We will update you as soon as possible.

Thanks,

Can you tell me the path that you used and worked for you?
It may help us locate the similar path in our environment.

What is going to take 3 weeks of implementation? Are you changing the implementation of Aspose.cells or you are creating a java utility to find the font paths?

Hi Suprita,

We too did not found any font in our Linux test environment. What we did was, we simple copy the font files from Windows operating system i.e. “C:\WINDOWS\Fonts\” to Linux operating system on path “/home/usr/test/winfont”.

Now pass this path as string to method mentioned below:
Workbook.getSaveOptions().setFontPath(new String[]{"/home/usr/test/winfont"});

As a workaround, you may try this method. On the other hand we are continuously making our progress to provide a better solution to this problem.

It takes approximately 3 weeks time because we have to rebuild implementation model to make JAVA use system fonts when it is unable to find needed fonts.

Thanks,

Hi Suprita,

Please use the updated version Aspose.CellsV2.4.0.1.zip attached. The enhancement has been made that if the needed font files are not found while generting the PDF, the default font files of JRE will be used. We hope that this will fit into your requirment.

Thank,