Word to PDF conversion exception on debian/Linux 10 with .net core 5

Hi,
I try to convert docx to pdf but it just creates pdf file with 0kb size and it throws an exception.
On windows while developing it works fine. But deployed on the linux server it didn’t work.
I tried to use Converter() with the filePath, and also with a Stream, but always the same problem.

Exception:
GroupDocs.Conversion.Exceptions.GroupDocsConversionException: Object reference not set to an instance of an object.
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertOptions convertOptions)
at f2p_api.Actions.Convert.ConvertToPdf(Int32 id, String path, String inputFileName, String outputFileName) in /home/vsts/work/1/s/File2PDF/f2p-api/Actions/Convert.cs:line 55

Dependencies:
-GroupDocs.Conversion(21.10.0)
-SkiaSharp.NativeAssets.Linux.NoDependencies (2.80.3)

System:
-Debian GNU/Linux 10

the code is running on

  • .net core 5

Code:
sampleCode.docx (14.8 KB)

1 Like

@MartinOstendis

Could you please share the problematic Word file? We’ll then look into this issue? Do you get this exception for all the Word files (or with a particular one)?

@Atir_Tahir

I have the same exception for every docx file.
for example: myDoc.docx (11.7 KB)

In addition, I tried other file types and received different exceptions:
A simple xlsx file:

GroupDocs.Conversion.Exceptions.GroupDocsConversionException: The type initializer for ’ threw an exception.
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertOptions convertOptions)
at f2p_api.Actions.Convert.ConvertToPdf(Int32 id, String path, String inputFileName, String outputFileName) in /home/vsts/work/1/s/File2PDF/f2p-api/Actions/Convert.cs:line 55

For a png file: myPng.png (12.0 KB)
Exception:
GroupDocs.Conversion.Exceptions.CorruptOrDamagedFileException: Cannot convert. The file is corrupt or damaged.
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
at GroupDocs.Conversion.Converter.Convert(SaveDocumentStream document, ConvertOptions convertOptions)
at f2p_api.Actions.Convert.ConvertToPdf(Int32 id, String path, String inputFileName, String outputFileName) in /home/vsts/work/1/s/File2PDF/f2p-api/Actions/Convert.cs:line 55

All 3 files converted well while developing on visual studio on my windows machine. Also the png is not corrupted or damaged. But deployed on the linux server it throws these exceptions.

1 Like

@MartinOstendis

We’re investigating this issue at our end. Your investigation ticket ID is CONVERSIONNET-4977. You’ll be notified in case of any update.

@MartinOstendis

Please install libgdiplus and fontconfig libraries on your system:

apt-get update
apt-get install -y libgdiplus
apt-get install -y ttf-mscorefonts-installer fontconfig

It’ll resolve the issue.

Thank you very much. It worked fine.

As a hint for others:
If you try to install the ttf-mscorefonts-installer on debian 10, you have to enable contrib in your /etc/var/source.list file.

The issues you have found earlier (filed as CONVERSIONNET-4977) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov