1
xls to pdf / html conversion failure on linux
Problem reported by RK - 11/9/2020 at 2:22 AM
Submitted
Hi,
I am trying to convert some xls files to pdf as well as Web format. The api that I created is based on .net core framework and I have dockerised it to run it on a linux container. Can you please confirm if these conversions are supported on linux or not ?

I am using the latest Nuget package - 5.7.0

I am getting the following exceptions - 
  • Web conversion (html) - 
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at _Wfc.Save(Stream stream, _waC saveOptions)
   at _zuC._Y8c._Ydd(Int32 pageNumber, Stream stream)
   at _ZfC._Yod(ConversionContext conversionContext, NumberRange range, Int32 finalPageNumber, Action`2 diskSaveCallback, Action`2 streamSaveCallback)
   at GleamTech.DocumentUltimate.DocumentConverter._zmd(OutputContext outputContext, Nullable`1 engine)
   at GleamTech.DocumentUltimate.DocumentConverter.ConvertTo(Dictionary`2& outputMemoryStreams, OutputOptions outputOptions, Nullable`1 engine)
  • Pdf conversion - 
_Wyd: The type initializer for '_Fm' threw an exception.
   at _Wfc.Save(Stream stream, _waC saveOptions)
   at _Wfc.Save(Stream stream, _wgc saveFormat)
   at _zuC._Y8c._Yvc(Stream stream)
   at _ZfC._YTc(ConversionContext conversionContext, Action`1 diskSaveCallback, Action`1 streamSaveCallback)
   at GleamTech.DocumentUltimate.DocumentConverter._zmd(OutputContext outputContext, Nullable`1 engine)
   at GleamTech.DocumentUltimate.DocumentConverter.ConvertTo(Dictionary`2& outputMemoryStreams, OutputOptions outputOptions, Nullable`1 engine)

3 Replies

Reply to Thread
1
Cem Alacayir Replied
Employee Post

You need to make sure libgdiplus is installed in your container image (System.Drawing.Common package depends on it).


Add the highlighted lines to your Dockerfile:


FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
RUN apt-get update -y && apt-get install -y apt-utils
RUN apt-get install -y libgdiplus && apt-get install -y libc6-dev
.
.
.

0
RK Replied
Thanks for your quick response.
I have installed the libgdiplus library in my docker container. Now, I am able to convert most of my files to pdf and html, except a few. The files which aren't getting converted all have an embedded document in the xls file. The embedded document is shown with an icon (as shown in the image attached along). I think this is causing trouble. Can you please confirm this? 

Pdf Conversion Error -
_Wyd: Shape to image Error!
   at _Wfc.Save(Stream stream, _waC saveOptions)
   at _Wfc.Save(Stream stream, _wgc saveFormat)
   at _zuC._Y8c._Yvc(Stream stream)
   at _ZfC._YTc(ConversionContext conversionContext, Action`1 diskSaveCallback, Action`1 streamSaveCallback)
   at GleamTech.DocumentUltimate.DocumentConverter._zmd(OutputContext outputContext, Nullable`1 engine)
   at GleamTech.DocumentUltimate.DocumentConverter.ConvertTo(Dictionary`2& outputMemoryStreams, OutputOptions outputOptions, Nullable`1 engine)
Html Conversion Error -
System.ArgumentException: Parameter is not valid.
   at _Wfc.Save(Stream stream, _waC saveOptions)
   at _zuC._Y8c._Ydd(Int32 pageNumber, Stream stream)
   at _ZfC._Yod(ConversionContext conversionContext, NumberRange range, Int32 finalPageNumber, Action`2 diskSaveCallback, Action`2 streamSaveCallback)
   at GleamTech.DocumentUltimate.DocumentConverter._zmd(OutputContext outputContext, Nullable`1 engine)
   at GleamTech.DocumentUltimate.DocumentConverter.ConvertTo(Dictionary`2& outputMemoryStreams, OutputOptions outputOptions, Nullable`1 engine)
0
RK Replied
Also,  do we have an option to set the name of the html documents same as the worksheet name? Currently the output html doc name is like - InputStream.xlsm-1.html, InputStream.xlsm-2.html etc. I think it's because I am using a stream as an input and not a file name/path. I want to name the html files on the worksheet name.

Reply to Thread