Excel Chart to PDF - wrong fonts appear in Java

Hello,


I am using Aspose.Cells v8.6.3 to generate PDF of chart - Test Chart in the attached excel file. In the PDF output, wrong fonts are used.

In Excel generated PDF, the font used is: Arial.
In Aspose generated PDF, the font used is: ArialUnicodeMS(Embedded Subset).

Following code is used to generate the output:

void chartToPDF() throws Exception {

Workbook workbook = new Workbook(“Test.xlsx”);

WorksheetCollection ws = workbook.getWorksheets();

String worksheetName = “Exhibits”;

Chart chart = ws.get(worksheetName).getCharts().get(“Test Chart”);

chart.toPdf(“D:\Aspose generated Test Chart.pdf”);

}

Can you please analyse this issue.


Thanks,
Neha

Hi Neha,

Thank you for supplying the sample for investigation.

If you check your sample in Excel in order to find out the font used for textual contents in the said chart, you will notice that HelveticaNeueLT font is being used for legend & labels (see attached snapshot). I suspect that you do not have this font installed on you machine therefore when rendering to PDF, Excel application used Arial font whereas Aspose.Cells for Java API used the Arial Unicode MS font, which is actually the improved revision of Arial font. Regarding the word Embedded Subset appended to the font name, this is because the Aspose.Cells APIs uses the sub-setting mechanism for PDF rendering process, that means, all the glyph from the source are embedded in the PDF. You may research on font sub-setting mechanism to get more details about it.