Unable to load DLL 'libSkiaSharp' | DocIORenderer.NETStandard | IIS

We are using "Syncfusion.DocIORenderer.NETStandard" version 16.1.0.32 to convert our doc files to pdf.

After published our project on a iis, I received in the stdout protocol the following exception:

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
--- End of inner exception stack trace ---
at Syncfusion.DocIORenderer.Drawing.RenderHelper.GetBitmap(Int32 width, Int32 height)
at Syncfusion.DocIORenderer.Rendering.PDFDrawingContext..ctor()
at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF(WordDocument wordDocument)
at Server.UserCode.LibWordSeriendruck.WordToPDF(Byte[] WordArray) in D:\Users\User\Documents\Visual Studio 2017\Projects\OurProject\OurProject\Server\UserCode\LibWordSeriendruck.cs:line 86
at Server.ControllersZ.z_wordController.WordBriefNeu(z_wordParameter wordParameter) in D:\Users\User\Documents\Visual Studio 2017\Projects\OurProject\OurProject\Server\ControllersZ\z_wordController.cs:line 201
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.d__2.MoveNext()
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 150.5755ms 500

I found the missing libSkiaSharp.dll in this directory:
C:\inetpub\wwwroot\OurProject\runtimes\win7-x64\native

For information:
The server is an windows server 2012 R2.

After copyed the file from C:\inetpub\wwwroot\OurProject\runtimes\win7-x64\native to the root directory C:\inetpub\wwwroot\OurProject the application works fine.

We would be happy when the issue could be fixed in a newer version.

Regards
LastCodeDE


13 Replies

MJ Mohanaselvam Jothi Syncfusion Team May 15, 2018 02:44 PM UTC

Hi LastCodeDE,

Thank you for contacting Syncfusion support.

We suspect that the issue might be due to the scenario of deploying the application at your end. A support incident to track the status of your query under your account has been created. Please log on to our support website to check for further updates,
https://www.syncfusion.com/account/login


Please let us know if you have any other questions.

Regards,
Mohanaselvam J



JM José Manuel December 6, 2018 01:14 AM UTC

I'am having the exact same issue. ¿Was there any solution?

I tried installing all syncfusion libraries equally in library project as well as in web project. 


PK Prakash Kumar D Syncfusion Team December 6, 2018 09:28 AM UTC

Hi LastCodeDE,

 

Thank you for contacting Syncfusion support.

 

We suspect that the problem might be due to missing of required NuGet packages in your application.

 

1.      If you are performing Word to PDF conversion in Linux environment means, could you please provide your confirmation on whether the SkiaSharp.Linux helper NuGet package is added properly in your application as per mentioned in the documentation.

 

2.      If you are using Linux in Docker container means, please ensure at your end whether the below line is added in the Dockerfile of your application to resolve the problem.

RUN apt-get update && apt-get install -y libfontconfig1

 

 

If the issue is still reproduced, then kindly share us your working Essential Studio version and issue reproducing sample which will be helpful for us to provide you the prompt solution.

 

Regards,

Prakash Kumar



JM José Manuel December 6, 2018 03:26 PM UTC

I solved it by installing SkiaSharp as a separate nuget package and that did the trick. Thanks


PG Pon Geetha A J Syncfusion Team December 7, 2018 05:42 AM UTC

Hi Jose, 
  
We are glad to know that your issue is resolved. 
  
Regards, 
Geetha 



AK Aaron Knipe September 17, 2019 03:20 PM UTC

I am now running into the below issues when converting a word doc to pdf.  I have the SkiaSharp nuget package installed, and I am still getting the below error

DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: Access is denied

TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.


using (var pdfDoc = renderer.ConvertToPDF(wordDoc)) {...}


VA Vijayasurya Anandhan Syncfusion Team September 18, 2019 05:48 AM UTC

1.      Hi Jose,

Thank you for your update.

We suspect the issue may occur due to any of the following reason:

1. SkiaSharp initialization problem in server.
2. Publishing the ASP.NET Core application in Self- contained mode.

We suggest to use below steps to overcome this reported issue:

1. Check whether production machine have proper .NET Core runtime installed.

2. Check Visual C++ Redistributable for Visual Studio 2015 installed in the production which is need to run SkiaSharp.

Download link:

https://www.microsoft.com/en-us/download/details.aspx?id=53587

Download link for 2017 VC++:
https://visualstudio.microsoft.com/downloads/
 
If the issue still persists, to resolve this problem, we recommend copying the libSkiaSharp manually from the SkiaSharp NuGet package into published folder.

1. Publish the ASP.NET Core application with SkiaSharp dependency in Self-Contained mode.

2. Download SkiaSharp v1.59.3 NuGet package from 
here.

3.
Unzip the skiasharp.1.59.3. nupkg.
 
Please refer the below tabular column to get the libSkiaSharp for corresponding target runtime. 
Copy libSkiaSharp from below location in SkiaSharp NuGet package into published folder for each target runtime: 
win-x86                               —           runtimes\win7-x86\native 
win-x64                               —           runtimes\win7-x64\native 
osx-x64                               —           runtimes\osx\native

 
Please let us know whether the suggested solution resolves the issue in your end.

Regards,
Vijayasurya A
 



JD Joseph Desmet replied to Vijayasurya Anandhan October 3, 2019 12:17 PM UTC

1.      Hi Jose,

Thank you for your update.

We suspect the issue may occur due to any of the following reason:

1. SkiaSharp initialization problem in server.
2. Publishing the ASP.NET Core application in Self- contained mode.

We suggest to use below steps to overcome this reported issue:

1. Check whether production machine have proper .NET Core runtime installed.

2. Check Visual C++ Redistributable for Visual Studio 2015 installed in the production which is need to run SkiaSharp.

Download link:

https://www.microsoft.com/en-us/download/details.aspx?id=53587

Download link for 2017 VC++:
https://visualstudio.microsoft.com/downloads/
 
If the issue still persists, to resolve this problem, we recommend copying the libSkiaSharp manually from the SkiaSharp NuGet package into published folder.

1. Publish the ASP.NET Core application with SkiaSharp dependency in Self-Contained mode.

2. Download SkiaSharp v1.59.3 NuGet package from 
here.

3.
Unzip the skiasharp.1.59.3. nupkg.
 
Please refer the below tabular column to get the libSkiaSharp for corresponding target runtime. 
Copy libSkiaSharp from below location in SkiaSharp NuGet package into published folder for each target runtime: 
win-x86                               —           runtimes\win7-x86\native 
win-x64                               —           runtimes\win7-x64\native 
osx-x64                               —           runtimes\osx\native

 
Please let us know whether the suggested solution resolves the issue in your end.

Regards,
Vijayasurya A
 


Dear,

I followed your advice regarding the unpacking of the libSkiaSharp assembly and making it available in the output/bin folder. I can't get this to work on Azure Service Fabric however. My published package contains both the libSkiaSharp & SkiaSharp assemblies, but I keep getting the same error:

  • DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    • SkiaSharp.SkiaApi.sk_colortype_get_default_8888()

    • SkiaSharp.SKImageInfo..cctor()


  • System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
       at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
       at SkiaSharp.SKImageInfo..cctor()

I'm positive both assemblies are present in the output folder - can you advice on how to resolve this issue please? I tried both the win-7-64 and win-10-64 versions since Azure SF requires x64 assemblies.

Thanks,
Joseph


VA Vijayasurya Anandhan Syncfusion Team October 7, 2019 10:12 AM UTC

Hi Joseph,

Thank you for your update.

Since you have mentioned in your previous update that the issue seems to be occur in Azure Service Fabric alone, we request to share the below details to proceed further in this.

1. Operating System used while creating an Azure service fabric cluster.
2. Visual Studio version
3. Sample with complete code example.
4. Machine configuration

Using the above details, we will set up similar environment in our end to reproduce the same issue which you have faced in your end while performing “Word to PDF conversion” in Azure service Fabric.

Please let us know if you have any questions.

Regards,
Vijayasurya A



AN ansar October 13, 2020 11:47 AM UTC

Started
PO Job error occuredSystem.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
   at SkiaSharp.SKImageInfo..cctor()
   --- End of inner exception stack trace ---
   at Syncfusion.DocIORenderer.Drawing.RenderHelper.GetBitmap(Int32 width, Int32 height)
   at Syncfusion.DocToPdfConverter.Rendering.PDFDrawingContext..ctor()
   at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF(WordDocument wordDocument)


it is in windows 10 server and .net core 2.1

i was working on this bug since 2 days. please let me know where should i correct.


HC Hemalatha Chiranjeevulu Syncfusion Team October 14, 2020 05:32 PM UTC

Hi Ansar,

Thank you for contacting Syncfusion support.

We suspect the issue may occur due to any of the following reason:

1. SkiaSharp initialization problem in server.
2. ASP.NET Core application is published in Self- contained mode.

We suggest to use below steps to resolve this reported issue:
1. Check whether production machine have proper .NET Core runtime installed.
2. Check Visual C++ Redistributable for Visual Studio 2015 installed in the production which is need to run SkiaSharp.

Download link:
https://www.microsoft.com/en-us/download/details.aspx?id=53587

Download link for 2017 VC++:
https://visualstudio.microsoft.com/downloads/
 
If the issue still persists, to resolve this problem, we recommend copying the libSkiaSharp manually from the SkiaSharp NuGet package into published folder.

1. Publish the ASP.NET Core application with SkiaSharp dependency in Self-Contained mode.
2. Download SkiaSharp v1.59.3 NuGet package from here.
3. Unzip the skiasharp.1.59.3. nupkg.
 
Please refer the below tabular column to get the libSkiaSharp for corresponding target runtime.  
Copy libSkiaSharp from below location in SkiaSharp NuGet package into published folder for each target runtime:

 
win-x86 
runtimes\win7-x86\native 
win-x64 
runtimes\win7-x64\native 
osx-x64 
runtimes\osx\native 

If you are still facing the same problem means, then kindly share us the below details from your side:
1. Sample application which used at your end.
2. Deployment procedure which you tried.
3. Published folder with all the files.
4. Details about the Syncfusion product version.
5. Details about the operating system which used at your end.

Please let us know if you have any other questions.

Regards,
Hemalatha C
 



AB Ankush Bute April 22, 2022 01:13 PM UTC

I am facing the same issue after deploying the asp.net core app on server, can you please help me to resolve this issue?

Version :- 20.1.0.47

* Install-package Syncfusion.Presentation.Net.Core

* Install-package Syncfusion.PresentationRenderer.Net.Core

* Install-package Syncfusion.SkiaSharpHelper.Net.Core

I am doing deployment using Visual studio publish option to deploy on Azure Web app server

sever operating system is Linux.

In local its working fine



SB Suriya Balamurugan Syncfusion Team April 25, 2022 10:52 AM UTC

Hi Ankush,

From the given details, we suspect that you have missed to install the dependent NuGet packages to perform Presentation to PDF conversion in your application.

Version

NuGet packages to install

From v20.1.0.x

SkiaSharp.NativeAssets.Linux v2.88.0-preview.209

HarfBuzzSharp.NativeAssets.Linux v2.8.2-preview.209


Similar to DocIO, please find the NuGet packages to be installed to perform Presentation to PDF conversion in Linux OS from below,
https://help.syncfusion.com/file-formats/docio/faq#what-are-the-nuget-packages-to-be-installed-to-perform-word-to-pdf-conversion-in-linux-os

Could you please install the above mentioned NuGet packages in your application and let us know whether the reported issue gets resolved.

If you still facing the issue means, then kindly provide us the complete runnable sample along with input Word document which will helpful to provide you the appropriate solution at the earliest.


Similar to DocIO, please refer the below link to know about how to convert Presentation to PDF in Azure App service on Linux,
https://www.syncfusion.com/kb/11888/how-to-convert-word-document-to-pdf-in-azure-app-service-on-linux

Regards,
Suriya Balamurugan.


Loader.
Up arrow icon