Convert a document with font Arial using Java

I encountered this error, can you help me , thanks!

class com.groupdocs.conversion.internal.c.a.ms.System.ArgumentException: FontFamily ‘Arial’ not found Parameter name: Arial com.groupdocs.conversion.internal.c.a.ms.System.Drawing.FontFamily.(Unknown Source) com.groupdocs.conversion.internal.c.a.ms.System.Drawing.FontFamily.(Unknown Source) com.groupdocs.conversion.operations.n.h(Unknown Source) com.groupdocs.conversion.operations.n.f(Unknown Source) com.groupdocs.conversion.operations.n.d(Unknown Source) com.groupdocs.conversion.operations.n$4.j(Unknown Source) com.groupdocs.conversion.operations.n.execute(Unknown Source) com.groupdocs.conversion.converter.markup.MarkupConverter.convert(Unknown Source) com.groupdocs.conversion.converter.markup.MarkupConverter.convert(Unknown Source) com.groupdocs.conversion.handler.ConversionHandler.aK(Unknown Source) com.groupdocs.conversion.handler.ConversionHandler.a(Unknown Source) com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)

1 Like

@YvanZhang,

Please share following details:

  • Sample code using that this error could be reproduced
  • Problematic source file (format) that you are trying to convert
  • Specify output file format

@atirtahir3
This is ok in my local Windows operating environment. This error occurs when deploying to a Linux server., do I need other special operations in the linux server

1 Like

@YvanZhang,

It seems more like a environment related issues rather than a back-end API issue. One of the possible solutions could be to install missing font (Arial) in your development environment (e.g. Linux server).

@atirtahir3 Ok,Thanks very much,let me try it.

1 Like

@YvanZhang,

You’re welcome.

错误.zip (2.5 KB)
sir, I was installed this font ,but also throw this exception,how can solve this problem,I waiting for your good news,thanks.

1 Like

@YvanZhang,

Please share following details. We’ll the further investigate this scenario:

  • Sample code/project using that issue could be reproduced
  • Share a list or screenshot of all the installed fonts in your development environment

demo.zip (679 Bytes)
sir,the demo is my code to convert stream to html,it is where the error was throwed.

@YvanZhang,

Thanks for the details. Can you please also share the sample/problematic DOCX file and list of installed fonts on your server.

sample.zip (9.5 KB)

@atirtahir3
Is there any good news, I am waiting for your reply!!

@YvanZhang,

You didn’t share a list of installed fonts on your server. Please have a look at this link as an example, it will help you to get all the installed fonts.

@atirtahir3font.zip (3.1 KB)

@YvanZhang,

Thanks. We’re investigating this scenario. Your investigation ticket ID is CONVERSIONJAVA-929. As there’s any further update, you’ll be notified.

1 Like

@atirtahir3
Any good news sir? I’m waiting online. :slight_smile:

1 Like

@YvanZhang,

This issue is still under investigation.

@YvanZhang,

Please provide path to ‘Arial’ font in your application and let us know if it resolves your issue.

ConversionConfig config= Utils.getConfiguration();
config.getFontDirectories().add(fontsPath);

If issue persists, kindly share API version that you are using (e.g. 19.10, 20.2).

1 Like

@atirtahir3
Thank you for your efforts. First of all, our client’s server will not install fonts. Secondly, if the client installs fonts, each client’s installation path is different.Impossible to write in code。

1 Like

@YvanZhang,

Let us share how it could work.

  • The font must be placed in a folder
  • The folder should have read permission
  • Than it should be provided in conversionConfig

API has included by default only system fonts path. Let’s understand this with an example, for MacOS fonts are in “/System/Library/Fonts”. Arial font is not there. Arial on MacOS can be found at “/Library/Fonts/Microsoft”. That’s why this folder has to be added as fonts source. Otherwise Arial cannot be found and loaded. This is due to how the fonts are organized on MacOS and is not related to API.
So you must find on your Linux system where the Arial font exists. If it is placed somewhere in the system, you have to add the folder to conversionConfig. If it doesn’t exist you may place it in any folder with read permission and provide that folder to conversionConfig.