Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Jun 17, 2022 6:17 pm

Hello,

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
Last edited by jchaarK2 on Mon Jun 20, 2022 6:12 pm, edited 2 times in total.

jchaarK2
 
Posts: 1
Joined: Fri Jun 17, 2022 6:07 pm

Mon Jun 20, 2022 3:06 am

Hello,

Thanks for your inquiry.

For this issue, please try to install the attached font in your MacOS system and test again.
timr45w.zip
(45.52 KiB) Downloaded 327 times
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.XLS