Free Support Forum - aspose.com

Excel made using Japanese or Chinses language convert to pdf having garbled code in result file

Hi,

I’ve got the following problem:
I’m trying to convert excel file to pdf.
This works flawlessly in Amonzon Linux 2.

Can anyone help me please?

Aspose.Cell:20.7
Java:1.8
OS: Amonzon Linux 2

Test Code:

List newFontPathsList = new ArrayList();
newFontPathsList.add("/usr/sare/font/googlefonts");
newFontPathsList.add("/usr/sare/font/externalFont");
FontRepository.setLocalFontPaths(newFontPathsList);
FontRepository.loadFonts();

Workbook book = new Workbook(new FileInputStream(inputFile));
addCustomDocumentProperties(book);
final PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setDefaultFont(“Sans”);
pdfSaveOptions.setOnePagePerSheet(true);
pdfSaveOptions.setCustomPropertiesExport(PdfCustomPropertiesExport.STANDARD);
book.save(os, pdfSaveOptions);

Excel made using english language can convert to pdf successfuly.
But it has garbled code in the pdf if origin file made using Japanese or Chinese.language

@grhuang,

It looks like missing fonts issue, so you need to have all the underlying fonts (Japanese or Chinese) in the workbook to be installed and set the relevant fonts folder in code at the start of your program before using any other Aspose.Cells APIs, see the document for your reference:

Please note, Aspose.Cells requires fonts (used in the workbook) for Excel to PDF, Excel to TIFF or Sheet to image rendering featuers.