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

Free Support Forum - aspose.com

Incorrect font names stored when DOC saved to PDF


  1. Aspose.Words.4.0.0.Beta for Java stores font names as “F{number}-{fontname}” instead of “{fontname}”. The attached are input document and two output documents - generated by Aspose and by Adobe plugin.
    Please repair the code (do not add “F{number}” into the font name in PDF) to keep the font name in original way because the document generated by Aspose cannot be later edited by Adobe tools.
  2. Several font folders.
    Is is possible to set several font folders isng the method PdfOptions.setTrueTypeFontsFolder(String fontsFolder)?
    It will be comfortable to allow to set different font folders together, for example:
PdfOptions options= new PdfOptions();

Best regards, Evgeniy

Important addition:
PDF specifies 14 fonts that are guaranteed to be included with any PDF viewer. As a result, these fonts do not need to be embedded into a PDF document when it is created. The 14 core PDF fonts are:
- Times Roman (Times New Roman) - Plain/Bold/Italic/Bold Italic
- Helvetica (Arial) - Plain/Bold/Oblique/Bold Oblique
- Courier - Plain/Bold/Oblique/Bold Oblique
- Symbol
- Zapf Dingbats
So please exclude embedding of the core fonts in output PDF documents.

Hi Evgeniy,

Thanks for your request and suggestion. I managed to reproduce the problem with font names on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved. (Note, conversion to PDF is in Beta in Aspose.Words for Java at the moment).
Regarding using core fonts, I linked your request to the appropriate issue. We will consider adding an option to control this. You will be notified as soon as the issue is resolved.
Best regards.

Hi Alexey,

  1. Could you please say if it is a chance to see such font support in February release of Aspose.Words for Java?
  2. Addition to 14 core fonts: As far they are specified by Adobe and have to be supported by each PDF producer it is necessary to include them into Aspose.Words package so client must not install them additionally to convert DOC file to PDF.
  3. Now Aspose.Words throws the following uninformational exception. Could you add missing font name here?
java.lang.IllegalStateException: Cannot find any fonts installed on the system.
at asposewobfuscated.qx.A(TTFontFiler.java:81)
at asposewobfuscated.oa.hc(PalFont.java:24)

Best regards, Evgeniy

Hi Evgeniy,

Thanks for your request.

  1. Unfortunately, at the moment, I cannot promise you that this fix will be included into the next version of Aspose.Words.
  2. We should deeply investigate this issue whether it is really necessary to embed these fonts into the library. We will let you know once this feature is implemented.
  3. Have you tried specifying TTF fonts folder? For instance:
Document doc = new Document("/usr/alexey/in.doc");
PdfOptions opt = new PdfOptions();
doc.saveToPdf(0, doc.getPageCount(), "/usr/alexey/out.pdf", opt);

Best regards.

Hi Alexey,
Thanks for your comments.

  1. It would be fine if you fix the problem with font names (redundant “Fn” at the start of name) in the nearest version, hope this is not very hard in implementation.
  2. Yes, I define TTF fonts folder but if the Aspose.Words does not find a font (at least one) it throws the exception without specifying which font is missing.
    Best regards, Evgeniy

Hi Evgeniy,

Thanks for your request.

  1. When we wrote code for generating font names, we followed the guidelines specified in the PDF standard. But MS Word 2007 produces “nice and readable” font names. We need to investigate what MS Word writes into PDF for these font names and try to do similar.
  2. I had the similar issue on Ubuntu with 4.0.0 version of Aspose.Words for Java. But after upgrading to 4.0.1 version, all works fine. You can download the latest version for here:
    Best regards.

Hi Alexey,
3. I am already working with version 4.0.1.
It seems that problem is somewhere deeply because I see unstable behaviour and unproducable cases. Today I could produce the documents without any errors, but yesterday I had them!
Could you please check if Aspose.Words caches some data or registers some options (similar to license)?
Best regards, Evgeniy

Hi Evgeniy,

Thanks for your inquiry. Aspose.Words should no cache anything. Maybe old version of Aspsoe.Words is cached somewhere and your application still uses the old version.
Best regards.

Hi Alexey,
I have two more requests about fonts when DOC converted to PDF:

  1. It is strictly required to have possibility to set fonts somehow in memory but not only with filesystem folder. This is needed because the Application can work without corresponding rights to filesystem. Now all other functionality of Aspose.Words is acceptable and to deal with Word documents we can load/save documents using memory (streams). The only restriction is we cannot save any document to PDF as far fonts folder can not be defined.
  2. Now fonts embedded into Word document are not used to convert documents to PDF and it’s necessary to have the same fonts in fonts folder. Is it possible to get embedded fonts from source Word document?
    Best regards, Evgeniy

Hi Evgeniy,

Thanks for your request.

  1. I think this is useful and reasonable suggestion, we will consider adding such feature in one of future versions of Aspose.Words.
  2. At the moment Aspose.Words does not support embedded fonts upon rendering. Your request has been linked to the appropriate issue. You will be notified as soon as this feature is available.
    Best regards.

Regarding issue 3 above:
We have a similar problem (running Aspose.words for Java We have a specified font folder, but keep the included fonts trimmed down to the necessary ones to reduce the size of our deployed jar-file. Our documents are generated in Aspose with MailMerge from word-templates, so it sometimes happens that one of the templates includes a new font (either on purpose by the customer, or by mistake e.g. a leftover style on an empty space is enough).
This causes the pdf generation to fail with the mentioned IllegalStateException and the very unhelpfull text “Cannot find any fonts installed on the system”, which makes it very hard to guess which fonts I have to add to the font-directory to make the doc work.

Is there any way to make Aspose print out which font it is actually missing?

A second question: Investigating this issue, I have read here on this forum that Aspose supposedly does font-substitution in these cases (or should be doing). Does this have to be enabled somewhere, so that my documents don’t suddenly fail in production if a new font is accidentally used?

Regards Jan Krag

P.S. I am sorry if this should have gone in a new thread. Feel free to upgrade the post or ask me to submit it elsewhere.

1 Like


Thanks for your request.

  1. Does the problem occur will all your documents or with some of them? Actually if there is at least one valid True Type font in the specified TrueType directory, conversion to PDF should work. Also could you please attach your fonts here for testing? I will check them and provide you more information.
  2. Aspose.Words always creates subsets of fonts upon converting to PDF. If Aspose.Words cannot find some font, it just uses an alternative font from available fonts.
    Best regards.

All our documents are currently working just fine. Our font directory contains (nearly) only those fonts that we actually use in the mailmerge templates:

As requested, these fonts are attached to this topic (fonts.zip).

The problem is, that if we suddenly use a new font (or font variant?) in our document, possibly by mistake (just a single space in the wrong styling is enough), then Aspose does NOT do font substitution, but instead fails hard with the very unhelpfull IllegalStateException that does not tell us which font is missing.

I would be very happy if I could somehow configure Aspose to actually do the font-substitution you mention above, and if I could somehow catch and print out exactly which font it is looking for so I can either provide this font if it was on purpose, or find and remove the offending style from my template document.

I hope this explains the issue a little better.

By the way, we save our PDF with the following method:

private void saveToPDF(Document doc, File tmpFile) throws Exception {
PdfOptions options = new PdfOptions();
doc.saveToPdf(0, doc.getPageCount(), tmpFile.getAbsolutePath(), options);

And the font-folder assignment works as expected, as I have numerous times had the problem with missing fonts, and made it go away by adding the new font to this directory. E.g. when we switched all our documents from Verdana to Arial.

Regards Jan

I just thought I should maybe add the generated stacktrace:

java.lang.IllegalStateException: Cannot find any fonts installed on the system.
at asposewobfuscated.qx.A (TTFontFiler.java:81)
at asposewobfuscated.oa.hc (PalFont.java:24)
at com.aspose.words.xb.Hd (SpanPr.java:231)
at com.aspose.words.sf.rr (Span.java:730)
at com.aspose.words.sf.getWidth (Span.java:593)
at com.aspose.words.zq.Jy (LineBuilder.java:88)
at com.aspose.words.zq.Jx (LineBuilder.java:30)
at com.aspose.words.bz.V (LinePart.java:281)
at com.aspose.words.k.c (ColumnBuilder.java:481)
at com.aspose.words.k.a (ColumnBuilder.java:163)
at com.aspose.words.k.a (ColumnBuilder.java:97)
at com.aspose.words.mw.a (PageBuilder.java:119)
at com.aspose.words.mw.a (PageBuilder.java:60)
at com.aspose.words.aji.b (SectionReflower.java:40)
at com.aspose.words.il.nG (MainTextSectionLayout.java:757)
at com.aspose.words.ql.nG (StoryLayoutBase.java:88)
at com.aspose.words.mu.nG (PageLayoutModel.java:124)
at com.aspose.words.yz.a (LayoutDocument.java:33)
at com.aspose.words.Document.updatePageLayout (Document.java:1637)
at com.aspose.words.Document.Iu (Document.java:1590)
at com.aspose.words.Document.getPageCount (Document.java:1618)
at dk.letpension.raadgivning.print.aspose.AsposeDocumentGenerator.saveToPDF
at dk.letpension.raadgivning.print.aspose.AsposeDocumentGenerator.generatePDF

A little sidenote:
The IllegalStateException is thrown in TTFontFiler.java:81, and if i intercept the exception during debugging, I can see that the method is called with a A String argument containing the name of the font to be used.
Would it be possible, in the next version, to include this font-name in the exception message so it says:
“Cannot find the specified font: …” instead of the incorrect and non-helpfull
“Cannot find any fonts installed on the system” currently used.


Thank you for additional information. I managed to reproduce the problem on my side. You request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Also, I managed to find a simple workaround. If this is acceptable, you can change font of document’s content before conversion to PDF. Here is simple code:

String fontName = "Arial";
Document doc = new Document("C:\\Temp\\in.doc");
// Create font changer
FontChanger changer = new FontChanger(fontName);
// Change font of the entire document
PdfOptions opt = new PdfOptions();
doc.saveToPdf(0, doc.getPageCount(), "C:\\Temp\\out.pdf", opt);

Hope this helps.
Also, you should note converting to PDF is in beta yet in Aspose.Words for Java.
Best regards.

Hi Alexey
Thanks for your quick reply.
I am not sure your workaround is usable in our case. Some of our customers documents are so simple and well defined that I know that only one font is used, but for the same reason these are not the ones to fail
The other documents are either very complex, or somehow user-configurable (editable contents), and on these I do not dare make a global font change.

I will be looking forward to a final version of pdf support where font-replacement works, and maybe a fix to improve the current error message in a future version.

Regards Jan

P.S: I have discovered a more specific problem with font-handling in insertHtml(), and will report this in a new thread.


Thank you for additional information. I will let you know once converting to PDF is out of beta in Aspose.Words for java.
Best regards.

The issues you have found earlier (filed as 13382) have been fixed in this update.

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

The issues you have found earlier (filed as 14051) have been fixed in this update.

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