We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error : java.lang.NoSuchMethodError: sun.font.FontManager.getFontPath(Z)Ljava/lang/String;

Hi


I am getting the subjected Error when trying to convert Excel document to pdf using workbook.save(). I am using JDK1.8 in windows OS. Your help is appreciated.

Regards,
Sathish D

Hi,


Thanks for providing us some details.

Could you provide us your template Excel file here, we will evaluate your issue soon.

Thank you.

Hi, I am using the same file which came with the aspose example package. I have tried out the following options to fix the issue as prescribed in your forum. Please find the code that I am using to convert the EXCEL to PDF

public class Excel2PDFConversion {

public static void main(String[] args) throws Exception {

// The path to the documents directory.

//Properties props = System.getProperties();

//props.setProperty(“com.aspose.cells.fontdir”, “C://Windows//Fonts”);

System.setProperty(“java.awt.headless”, “true”);

//-DAspose.Cells.Disable=SunFontManager

String dataDir = Utils.getSharedDataDir(Excel2PDFConversion.class) + “loading_saving/”;

Workbook workbook = new Workbook(dataDir + “Book1.xls”);

// Save the document in PDF format

workbook.save(dataDir + “E2PDFC-out.pdf”, SaveFormat.PDF);

// Print message

System.out.println(“Excel to PDF conversion performed successfully.”);

}

}

Hi,


I tried your exact code using your template file with (Aspose.Cells for Java (Latest Version) please try it. It works absolutely fine, the output PDF file is attached for your reference.

I am using JDK1.7 on Windows 8. We will try to test it on JDK1.8 as well. But could you try on some other machine with JDK1.6/1.7 if you still see the issue.

Thank you.

Hi, the error got resolved when I updated the jar to the latest version aspose-cells-16.12.3 from aspose-cells-7.0.0. thanks for you support

Hi,


Good to know that your issue is resolved by the latest version/fix. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.