Cannot find any fonts installed on the system error

Aspose.slides - 17.8-jdk1.6
Apose cell - 17.10

OS - ubuntu 14.4
JDK -1.8

Program is working good in windows 10 env but not working in ubuntu.
It is giving error Cannot find any fonts installed on the system.
I tried to set external font folder but its not working.

@kedar.675,

I have observed your comments. Can you please share source presentation, sample project so that we may further investigate to help you out.

response.zip (33.9 KB)

test.java

Test.Java

public void mytest() throws Exception {

Workbook workbook = new Workbook("C:\\Users\\kedar\\Desktop\\a.xlsx");
Worksheet fws = workbook.getWorksheets().get(0);
String firstCell = fws.getCells().getFirstCell().getName();
String lastCell = fws.getCells().getLastCell().getName();
String sheetName = fws.getName();
String range = sheetName+"!"+"\""+firstCell+":"+lastCell+"\"";
System.out.println(range);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().add(“Pivot”);

int pivotIndex = worksheet.getPivotTables().add(range,"F3","PivotTables");
PivotTable pt = worksheet.getPivotTables().get(pivotIndex);
pt.setRowGrand(false);
pt.setColumnGrand(false);
pt.setAutoFormat(true);
pt.getRefreshDataOnOpeningFile();
pt.refreshData();
pt.addFieldToArea(PivotFieldType.ROW, 2);
pt.addFieldToArea(PivotFieldType.COLUMN,0);
pt.addFieldToArea(PivotFieldType.DATA, 1);

int sheetIndex = workbook.getWorksheets().add(SheetType.CHART);
Worksheet sheet3 = workbook.getWorksheets().get(sheetIndex);

sheet3.setName("PivotChart");
int chartIndex = sheet3.getCharts().add(ChartType.LINE, 5, 5, 20, 10);
Chart chart = sheet3.getCharts().get(chartIndex);

chart.setPivotSource("Pivot!PivotTables");
chart.setHidePivotFieldButtons(false);
chart.getAutoScaling();

// chart.getShowDataTable();
// chart.setShowDataTable(true);
workbook.save(“C:\Users\kedar\Desktop\b.xlsx”);
AddToPPT.Run();

}

add_to_ppt.java

AddToPPT.java

public class AddToPPT {
public static void Run() throws Exception {

com.aspose.slides.License l = new com.aspose.slides.License();
l.setLicense("C:\\Users\\kedar\\Documents\\JARS\\Aspose Licence\\Aspose.Slides.lic");
Workbook wb = new Workbook("C:\\Users\\kedar\\Desktop\\b.xlsx");

int chartRows = 55;
int chartCols = 25;
Worksheet sheet3 = wb.getWorksheets().get(2);

sheet3.setName("PivotChart");

com.aspose.cells.ImageOrPrintOptions opts= new com.aspose.cells.ImageOrPrintOptions();
opts.setImageFormat(com.aspose.cells.ImageFormat.getPng());
ByteArrayOutputStream imageStream=new ByteArrayOutputStream();
wb.getWorksheets().get(2).getCharts().get(0).toImage(imageStream, opts);
//wb.getWorksheets().get(2).getCharts().get("PivotChart").getChartObject().getChart();

ByteArrayOutputStream bout=new ByteArrayOutputStream();

wb.save(bout,com.aspose.cells.SaveFormat.EXCEL_97_TO_2003);
//Create a presentation
Presentation pres = new Presentation();
ISlide sld = pres.getSlides().get_Item(0);
//Add the workbook on slide
AddExcelChartInPresentation(pres, sld, bout.toByteArray(), imageStream.toByteArray());
//Write the presentation to disk

}

static void AddExcelChartInPresentation(Presentation pres, ISlide sld, byte[] wbArray, byte[] imgChart) throws Exception
{
double oleHeight = pres.getSlideSize().getSize().getHeight();
double oleWidth = pres.getSlideSize().getSize().getWidth();
Workbook wb=new Workbook();

//Createing and EXCEL_97_TO_2003 LoadOptions object
com.aspose.cells.LoadOptions loadOptions = new com.aspose.cells.LoadOptions(com.aspose.cells.FileFormatType.EXCEL_97_TO_2003);
Workbook wbs=new Workbook(new ByteArrayInputStream(wbArray),loadOptions);

IOleObjectFrame oof = sld.getShapes().addOleObjectFrame(0f, 0f, (float)oleWidth, (float)oleHeight, "Excel.Sheet.8", wbArray);
oof.getSubstitutePictureFormat().getPicture().setImage(pres.getImages().addImage(new ByteArrayInputStream(imgChart)));
//oof.setUpdateAutomatic(true);
IOleObjectFrame Pic = oof;
oof.setUpdateAutomatic(false);
IBaseShapeLock PicLock = Pic.getShapeLock();

//Applying shapes locks

pres.save("C:\\Users\\kedar\\Desktop\\outputT.pptx", com.aspose.slides.SaveFormat.Pptx);

}
}

@kedar.675,

I have observed your comments. An issue with ID SLIDESJAVA-36731 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

@kedar.675,

I like to inform that our product team investigated issue in details. This exception means that Aspose.Slides can not access the fonts (default directory - /usr/share/fonts) or TTF fonts are not installed.
You should provide TTF fonts for Aspose.Slides using FontsLoader or install them. Can you please try to use latest version of Aspose.Slides instead of Aspose.Slides for Java 17.8. Also If this solution does not help, can you please provide a list of installed fonts (fc-list command).

Hi Adnan.Ahmad,
Thanks for supporting. No fonts were installed in system.
I put some fonts in fonts dir.
Now program is working fine .
Thanks for supporting. Appreciate your help :slight_smile:

@kedar.675,

We are glad to know that things are started working on your end. Feel free to contact us if there is still any issue.

The issues you have found earlier (filed as SLIDESJAVA-36731) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz