Free Support Forum - aspose.com

Font replacement in PDF output from Excel spreadsheet

Hi Shakeel,


We are facing an issue with the aspose.cells v8.5.0 where the font replacement is causing the PDF output to be very different than the intended output.

Please see the two attached PDF outputs for details where one was generated using v8.3.2 and the other using v8.5.0

Thanks,
Arminder

Hi Arminder,

Thanks for your posting and using Aspose.Cells.

It seems, Aspose.Cells is unable to find fonts at your end. I have tested this issue with the latest version: Aspose.Cells for Java 8.5.1 with the following sample code and it generated the correct pdf with proper fonts. I have attached the output pdf for your reference.

Are you trying your code on Windows or Linux machines? In case of Windows, you do not need to give fonts directory path but in case of Linux, you have to specify in which directory your fonts are present.

If you check fonts inside your correct pdf, you will see you actually need two fonts which are shown in the screenshot. One is ArialUnicodeMS and other is TrebuchetMS.

In case, you are using Linux, please place these fonts in some directory. Suppose, you place it in /usr/share/fonts/mydir then you will have to set it with CellsHelper.setFontDir() like this before saving to pdf.

CellsHelper.setFontDir("/usr/share/fonts/mydir")

Now
Aspose.Cells will use the fonts in this directory while converting your
Excel into PDF and you will get a proper output.

Please also see the following article for your more help.

( http://www.aspose.com/docs/display/cellsjava/Aspose.Cells+Font+Usage )

Java


String filePath = “F:\Shak-Data-RW\Downloads\Production+Control+Chart.xlsx”;


//If you are on Linux, then add font directory path

//On Windows, you do not need to add it but fonts should be installed on machine

CellsHelper.setFontDir(fontDirPath)


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.getWorksheets().get(“Manufacturing Imperfections”);

worksheet.getPageSetup().setPrintArea(“B15:M28”);


PdfSaveOptions opts = new PdfSaveOptions();

opts.setOnePagePerSheet(true);


workbook.save(filePath + CellsHelper.getVersion() + “.out.pdf”, opts);

Hi Shakeel,


Thank you for your quick response. However, please note that I ran the test on the same Windows 7 machine with Aspose 8.3.2 and then with Aspose 8.5. So, not sure why I should be seeing different results when working with these two different versions? Is it possible that the issue was somehow introduced in 8.5 and fixed in 8.5.1? Can you share your test results with 8.5 as well?

Thanks,
Arminder

Hi Arminder,

Thanks for your posting and using Aspose.Cells.

Yes, you are right. The issue occurs on v8.5.0 and is fixed in v8.5.1. I have attached the output pdf of v8.5.0 for your reference.

Also, notice how the PDF output via 8.5.1 in your sample is also causing the last word to jump to the next line instead of staying in a single line. Please refer attached screenshot for details.


Thanks,
Arminder

Hi Arminder,

Thanks for your feedback, screenshot and using Aspose.Cells.

We were able to observe this regression and logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-41421 - Last word on chart textbox jumps to the next line

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for Java v8.5.1.6
and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-41421) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.