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.

Sun Jan 16, 2022 7:43 pm

Hello,

I am trying to convert .xls file to PDF using spire.xls.
I am using spire.xls.free version: 3.9.1, my project is in java 11 maven 3. My PC run on MacOS.

My code is. very simple:
public static void convertXlsToPdf(String xlsFile, String pdfFileNameAndPath) {
//Create a Workbook
Workbook workbook = new Workbook();
workbook.loadFromFile(xlsFile);

//Fit to page
workbook.getConverterSetting().setSheetFitToPage(true);
workbook.saveToFile(pdfFileNameAndPath, FileFormat.PDF);
}


The error is thrown on new Workbook():
java.lang.ExceptionInInitializerError
at com.spire.xls.packages.spraHC.spr (tpg:753)
at com.spire.xls.packages.spraHC.<init>(tpg:465)
at com.spire.xls.packages.spraHC.<init>(tpg:457)
at com.spire.xls.packages.spryZa.spr (Unknown Source)
at com.spire.xls.core.converter.spreadsheet.WorksheetCollection.spr (Unknown Source)
at com.spire.xls.core.converter.spreadsheet.WorksheetCollection.spr  (Unknown Source)
at com.spire.xls.core.converter.spreadsheet.WorksheetCollection.<init>(Unknown Source)
at com.spire.xls.packages.sprxOa.<init>(Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorkbook.<init>(Unknown Source)
at com.spire.xls.Workbook.<init>(Unknown Source)
.......
.....
Caused by: class com.spire.xls.packages.sprYwc: FontFamily 'Serif' not found
Parameter name: Serif

Can someone please help me?
Thaks.

teodors2
 
Posts: 3
Joined: Sat Mar 14, 2020 11:08 am

Mon Jan 17, 2022 10:26 am

Hello,

Thank you for your inquiry.
According to your description, I guess that the issue is caused by your system not installing this font or not having permission to read the "Serif" font file. Please make sure your system has this font installed and that you have permission to read this font file information.
In addition, I suggest that you use our commercial version (the latest version is Spire.XLS Pack(Hotfix) Version:11.12.2), which conatins more fixes and new features than the free one. We are willing to provide you with a one-month temporary license to evaluate without any watermarks and restrictions, please apply for a temporary license from this link: https://www.e-iceblue.com/TemLicense.html. If the issue still exists after trying, please provide your input excel file and system information (eg macOS high Sierra Version 10.13) for further investigation. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Mon Jan 31, 2022 8:54 pm

Hello,

Thank you for your response and suggestions.
I check my sistem fonts and I saw only "PT Serif" font installed. I searched on internet for "Serif" font to download but I did't find this font for macOS.
My system has macOS Monterey - version 12.1 (on Catalina I don't remember to have this issue).
The problem appears when it's trying to call the constructor "new Workbook() " so it's not important the excel file here.

Regards,
Teodor

teodors2
 
Posts: 3
Joined: Sat Mar 14, 2020 11:08 am

Tue Feb 01, 2022 9:43 am

Hello,

Thanks for your feedback.
As the Chinese New Year is coming, our office will be closed from 01/31/2022 to 02/06/2022 (GMT+8:00), once we return to work on Feb 07, 2022,we will investigate your issue immediately. Thanks again for your understanding.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Mon Feb 07, 2022 9:48 am

Hello,

Thanks for your patience.
I tested your case on the same system as you and found that the free Spire.XLS for Java does have the issue you mentioned, but the commercial version fixes this issue. Since we only maintain the free version irregularly. I suggest that you use our commercial version (the latest version is Spire.XLS for Java Version:5.1.5), which contains more fixes and new features than the free one. We are willing to provide you with a one-month temporary license to evaluate without any watermarks and restrictions, please apply for a temporary license from this link: https://www.e-iceblue.com/TemLicense.html. If there is any question, please feel free to write back.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Thu Feb 10, 2022 3:48 pm

Hi Annika,

Thank you so much for investigation.
I am using the free Spire.XLS very rarely and for personal use.
Thank you for your suggestion to try the commercial version but I think I will find another free service. I have to convert max 10 documents/month and I don't want to pay for that because I can use the Office option to save as pdf :). I used the free Spire.XLS only for my confort :D.

I Appreciate the e-iceblue services.
Thank you for support
Teodor

teodors2
 
Posts: 3
Joined: Sat Mar 14, 2020 11:08 am

Fri Feb 11, 2022 1:14 am

Hello,

Thank you for your recognition of our service.
If you have other questions about using our products in the future, please feel free to contact us.
Have a nice day!

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS