So I am trying to build a Java application that will save an excel sheet to a PDF file. However, by using the free version of Spire.XLS (version 5.1.0), I am constantly getting a missing error font 'Serif' when I call the method saveToPdf from the Worksheet class. Please note That I am testing my code with the macOS environment and will be deploying it into a Linux server.
Sample of the Code:
- Code: Select all
Workbook workbook = new Workbook();
workbook.loadFromFile("FILE.xlsx");
workbook.getConverterSetting().setSheetFitToPage(true);
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.saveToPdf("OUTPUT.pdf");
error:
- Code: Select all
Warning: the font "Times" is unavailable, so "Lucida Bright" has been substituted, but may have unexpected appearance or behavor. Re-enable the "Times" font to remove this warning.
Warning: the font "Times" is not available, so "Lucida Bright" has been substituted, but may have unexpected appearance or behavor. Re-enable the "Times" font to remove this warning.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.spire.xls.packages.sprfWC.spr (fhg:418)
at com.spire.xls.packages.sprfWC.<init>(fhg:239)
at com.spire.xls.packages.sprfWC.<init>(fhg:749)
at com.spire.xls.packages.sprAva.<clinit>(Unknown Source)
at com.spire.xls.packages.sprpWa.<init>(Unknown Source)
the font "Times" is not available, so "Lucida Bright" has been substituted, but may have unexpected appearance or behavor. Re-enable the "Times" font to remove this warning.
at com.spire.xls.packages.sprpWa.<init>(Unknown Source)
at com.spire.xls.packages.sprlUa.spr (Unknown Source)
at com.spire.xls.packages.sprANa.spr (Unknown Source)
at com.spire.xls.packages.sprkpA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprMPA.spr (Unknown Source)
at com.spire.xls.packages.sprvDB.spr (Unknown Source)
at com.spire.xls.packages.sprHPA.spr (Unknown Source)
at com.spire.xls.packages.sprHPA.spr (Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorkbook.spr (Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorkbook.spr (Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorksheet.saveToPdf(Unknown Source)
at excel_to_pdf.App.main(App.java:27)
Caused by: class com.spire.xls.packages.sprgkC: FontFamily 'Serif' not found
Parameter name: Serif
Caused by: class com.spire.xls.packages.sprgkC: FontFamily 'Serif' not found