Free Support Forum - aspose.com

Pdf Conversion using Aspose.Words v10.0.1

Hello,

I just tried saving a word document as pdf on a debian edge linux machine.

I caught the following error:

Cannot find any fonts installed on the system. (IllegalStateException)

There are several .ttf-fonts in /usr/share/fonts.
Where does Aspose.Words look for fonts on linux boxes?


Best regards,

Martin

Hello

Thanks for your request. 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.

Use the new 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");

http://www.aspose.com/documentation/java-components/aspose.words-for-java/specifying-font-locations-when-converting-to-fixedpage-formats.html

Best regards,