Hi there,
Thanks for your inquiry. Please note old generator aspose.pdf is depreciated, it is recommended to use new generator (com.aspose.pdf). In non Windows OSs, If you want to use font name using FindFont() then you need to add font folder path as Document.addLocalFontPath(fontDir). However if you want to user complete font file name then you can use OpenFont() method. Please check sample code as following, it will help you to accomplish the task.
// Set font folder path<o:p></o:p>
String path = "/usr/share/fonts/truetype/msttcorefonts/";
// Adding a font directory
com.aspose.pdf.Document.addLocalFontPath(path);
// Added document
Document doc = new
com.aspose.pdf.Document();
// default font
TextState textState = new TextState();
textState.setFont(FontRepository.findFont("Times-Roman"));
doc.getPageInfo().setDefaultTextState(textState);
PageInfo pageInfo = doc.getPageInfo();
MarginInfo marginInfo =
pageInfo.getMargin();
marginInfo.setLeft(10);
marginInfo.setRight(10);
marginInfo.setTop(30);
marginInfo.setBottom(30);
com.aspose.pdf.Table table = new
com.aspose.pdf.Table();
table.setColumnWidths("50 100");
// added page.
Page curPage = doc.getPages().add();
//Font font
=FontRepository.openFont("C:\\Users\\ubpaul\\Downloads\\KERALITE.TTF");
for(int
i=1;i<=20000;i++){
com.aspose.pdf.Row row =
table.getRows().add();
row.setFixedRowHeight(15);
for(int ii=0;ii<8;ii++){
com.aspose.pdf.Cell cell1 =
row.getCells().add();
com.aspose.pdf.TextFragment
textFragment = new com.aspose.pdf.TextFragment("Content 1 ");
cell1.getParagraphs().add(textFragment);
}
}
Paragraphs paragraphs =
curPage.getParagraphs();
paragraphs.add(table);
doc.save("textInUnix.pdf");
Please feel free to contact us for any further assistance.
Best Regards,