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

Free Support Forum - aspose.com

Aspose java issue in unix - "Cannot find any fonts installed on the system."

Hi,

I am using following code to convert rtf to pdf. It works fine is Windows but not in unix. I tried some options given by aspose, but did not work. Someone please suggest what will be the changes to following code to work in unix..

byte[] inputData=(byte[])fileData;
InputStream ins = new ByteArrayInputStream(inputData);
Documen doc = new Document(ins);
ByteArrayOutputStream out=new ByteArrayOutputStream();
doc.save(out, SaveFormat.PDF);
inputData=out.toByteArray();

Thanks,

Sunam

Hello

Thanks for your request. When you render documents to PDF, XPS or convert to EPUB that requires embedding of fonts into a document, then Aspose.Words needs to have access to TrueType fonts. If you run Aspose.Words on a Windows system, then by default it will search for fonts in the system Windows\Fonts folder. But if you run Aspose.Words on a Linux system, it does not have a default location for fonts and you need to specify it explicitly.

Please try using com.aspose.words.FontSettings class and setFontsFolder/setFontsFolders methods to specify the location of TrueType fonts.


FontSettings.setFontsFolder("C:\\Users\\Andrey\\IdeaProjects\\awtest");

DocumentBuilder b = new DocumentBuilder();

b.getFont().setName("Water on the Oil");

b.getFont().setSize(72);

b.writeln("Hello World!");

b.getDocument().save("TestHelloWorld Out.pdf");

Best regards,