Convert PDF to DOCX, fonts substitution issue in Java

Hi,

We are using groupdocs for Document conversions. Facing below issue while trying to convert pdf to docx. Please let us know the cause and how to fix it.

30-Jul-2019 01:59:34.987 SEVERE [http-nio-8080-exec-7] com.snc.documentconversion.groupdocs.GroupDocsConverter.convert Conversion failed for request id **** class com.groupdocs.conversion.internal.c.a.pd.internal.ms.System.I174: Cannot find any fonts installed on the system.
com.groupdocs.conversion.internal.c.a.pd.internal.l61l.I17.lif(Unknown Source)

Regards,
Tirumala Reddy

1 Like

@Tirumala_Reddy,

In order to investigate this issue at our end, we need following details:

  • API version that you integrated in the project
  • OS version
  • Problematic PDF file
  • Sample code for conversion process/purpose

Sorry for the delay
Groupdocs Java version - 18.12,
OS - Cent OS 7
problematic PDF file - Pretty much happening for every file.
Sample Code :

private void convertToWordAsFilePath(ConversionRequest documentConversionRequest) {

ConversionHandler conversionHandler = new ConversionHandler(getConfiguration(documentConversionRequest));
WordsSaveOptions saveOption = new WordsSaveOptions();
ConvertedDocument convertedDocumentPath = conversionHandler.convert(documentConversionRequest.getInputFileName(), saveOption);
convertedDocumentPath.save(documentConversionRequest.getOutputFileName());
}

Its working fine in local Cent OS VM installed in local, but failing in our VM deployed in Lab.

@Tirumala_Reddy,

This could be because the font that the source document has is not available/installed in VM but installed in your local environment.
But the good thing is API provides default font and font substitution feature.
Set font path:

String fontsPath = projectPath + "/Fonts/" ;

Setup configuration:

ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.getFontDirectories().add(fontsPath);

You can either install the font(s) that is missing in your VM or load them to the API by following the above steps.
Let us know if this resolves your issue.

What kind of Font config we need to add in /Fonts/ Directory. Do you have any config which has all Fonts related info, we can use that.

We basically want it to work on any server, Please let me know the font config that I need to put in Font Directory.

@Tirumala_Reddy,

You have to put/copy the font (if not available, download it) in the directory manually and then pass that path to the config (as code shared in previous reply).

We are further investigating this scenario. Your investigation ticket ID is CONVERSIONJAVA-735. As we have any further information, you’ll be notified.

Its better if you guys can provide us all the font related info, which we can put in some directory and load it. That would solve everyones problem, we have no idea, what exactly we have to download.

1 Like

@Tirumala_Reddy,

This is still under investigation, we’ll notify you as there’s any update.

Hi Tahir,

By when I can expect update, we are going live soon with pdf to docx conversion. We need this as soon as possible.

Regards,
Tirumala Reddy

@Tirumala_Reddy,

API doesn’t provide such feature. However, in order to avoid any such issue, you can use default font feature. We are still investigating this, you’ll be notified as we have further update.

What do you mean by default font feature ?

@Tirumala_Reddy,

In default font feature you actually add or specify some particular font in place of the missing one.
How this is helpful?
Let me further elaborate, if your document is using a font that is not installed on the server. In that case, to avoid any issue you can specify a default font that is available on server and it will be used in place of missing one.

WordsLoadOptions loadOption = new WordsLoadOptions(); 
loadOption.setDefaultFont("Arial");

You can see what is the most common font(s) that is easily available on any server and specify that as default font. Please use this code in your project and see if you get rid of the error.

Hi Tahir,

What is the guarantee that this default is available on any server ? Its better if you guys can give us fonts data, which we can load before conversion and also set one of these as default.

Please let us know the ETA, we have complete license for JAVA conversion platform, and have to go live with pdf to docx conversion soon.

Regards,
Tirumala Reddy

@Tirumala_Reddy,

We are looking into this scenario. Please note that we investigate the issues at first come first served basis. Therefor, we cannot share any ETA at the moment.
However, you can also avail priority support in order to expedite the issue .

Thank you posted there.

1 Like

@Tirumala_Reddy,

You’re welcome.

correction . .

@Tirumala_Reddy,

Alright.