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

Free Support Forum - aspose.com

Cannot find any fonts installed on the system.null

Hi,
I have a simple Java program that opens various formats of Word documents (97, 2000, 2007), does a string substitution, and then saves the file to PDF. I’m getting exceptions during the save:
Cannot find any fonts installed on the system.null
Can you point me to the documentation that addresses the fonts. Is there a context that needs to be set before a PDF can be created?
Many thanks,
Martin

This message was posted using Email2Forum by alexey.noskov.

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");

https://releases.aspose.com/words/java
Best regards,

Thanks Andrey. I was able to resolve this issue yesterday by dropping in Times New Roman fonts into the /System/Library/Fonts directory on my MacBook Pro. This suggestion came from another thread on this forum. I was able to code what I was trying to do with aspose.words.

I work on Unix/Linux most of the time and was looking for a solution specific to the platform. This workaround seems pretty obscure. Why is it that the Times New roman font needs to be present even if the document does not contain it? Does aspose.words have a dependency on it that is unnecessary? If so, could 10.0.0 correct that?

Best,

Martin

Hi Martin,
Thanks for your request. The problem probably occurred because Aspose.Words could not read fronts installed on your side. Once you installed Times New Roman fonts Aspose.Words recognized it as valid MS TTF fonts and managed to read it. That is why the problem stopped to occur when you installed this font.
If you use old version of Aspose.Words for Java (4.0.3 and older) then the problem is expected. Because these versions of Aspose.Words for Java cannot read Macintosh fonts.
Best regards,

What about including the ‘well known’ system font paths by default?
Eg ‘/Library/Fonts/’ for os.name==MacOs etc.

  1. What about improving the error message “Cannot find any fonts installed on the system”?
    It should include which font could not be found, and which font paths were used for the lookup.

Hi
Thanks for your suggestion.

  1. I logged your suggestion into our defect database. Currently by default Aspose.Words looks for fonts in Windows fonts folder.
  2. There is no sense to improve this error message because it is thrown only where there are no fonts at all. If there is at least one fonts Aspose.Words will use it for rendering. I.e. Aspose.Words does not throw where cannot find a specific font.
    Best regards,

The issues you have found earlier (filed as WORDSJAVA-86) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.