Free Support Forum - aspose.com

Saving .doc to .pdf on non windows platforms

Hi all,

I’ve trouble in exporting .doc files to .pdf on linux (ubuntu) / mac os x,

java.lang.IllegalStateException: Cannot find any fonts installed on the system.
at asposewobfuscated.pi.a(TTFontFiler.java:106)
at asposewobfuscated.pi.a(TTFontFiler.java:35)
at com.aspose.words.n.b(AttributeConverter.java:59)
at com.aspose.words.fp$b.C(DocumentRunSplitter.java:484)
at com.aspose.words.fp$b.moveNext(DocumentRunSplitter.java:456)
at com.aspose.words.fp.a(DocumentRunSplitter.java:200)
at com.aspose.words.aof.Ud(RunWriter.java:170)
at com.aspose.words.aof.b(RunWriter.java:138)
at com.aspose.words.fp.(DocumentRunSplitter.java:77)
at com.aspose.words.aqr.a(SpanGenerator.java:225)
at com.aspose.words.fq.ak(DocumentSpanConverter.java:652)
at com.aspose.words.fq.Bl(DocumentSpanConverter.java:592)
at com.aspose.words.fq.moveNext(DocumentSpanConverter.java:167)
at com.aspose.words.fq.AH(DocumentSpanConverter.java:203)
at com.aspose.words.vk.a(LayoutDocument.java:37)
at com.aspose.words.Document.updatePageLayout(Document.java:1399)
at com.aspose.words.Document.ab(Document.java:1332)
at com.aspose.words.Document.zy(Document.java:1345)
at com.aspose.words.Document.getPageCount(Document.java:1380)
at com.aspose.words.pm.a(FixedPageWriterBase.java:21)
at com.aspose.words.Document.a(Document.java:1277)
at com.aspose.words.Document.save(Document.java:708)

Any ideas?

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.

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,