Free Support Forum - aspose.com

Unable to find an entry point named 'GdiplusStartup' in DLL 'libgdiplus'


#1

When I use Aspose.Total.Net convert ppt/excel to png or html,I meet some problems, the word is good. As follows:
System.TypeInitializationException: The type initializer for ‘Gdip’ threw an exception. —> System.EntryPointNotFoundException: Unable to find an entry point named ‘GdiplusStartup’ in DLL ‘libgdiplus’.
2019-01-06 17:30:03 at System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate()
2019-01-06 17:30:03 at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
2019-01-06 17:30:03 at System.Drawing.SafeNativeMethods.Gdip…cctor()
2019-01-06 17:30:03 — End of inner exception stack trace —
2019-01-06 17:30:03 at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
2019-01-06 17:30:03 at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
2019-01-06 17:30:03 at …ctor(Workbook )
2019-01-06 17:30:03 at …ctor(Workbook , String , String , Stream , HtmlSaveOptions )
2019-01-06 17:30:03 at …ctor(Workbook , String , String , HtmlSaveOptions )
2019-01-06 17:30:03 at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)
2019-01-06 17:30:03 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:30:03 at Com.Cmb.OA.Documents.Transfer.Utility.InjectInterceptor.Intercept(IInvocation invocation) in /var/jenkins_home/pl014464/Utility/InjectInterceptor.cs:line 17
2019-01-06 17:30:03 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:30:03 at Com.Cmb.OA.Documents.Transfer.Controllers.FileToHtmlController.ToHtml(IFormFile file) in /var/jenkins_home/pl014464/Controllers/FileToHtmlController.cs:line 66

But the project is good in Windows, the error occurs in Linux Docker.

And there is another problem,When I convert pdf to png or html,I meet some problems.As fllows:
2019-01-06 17:36:01 An unhandled exception has occurred while executing the request.
2019-01-06 17:36:01 ​ : Unexpected font parsing exception —> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘/usr/share/fonts/truetype/msttcorefonts’.
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path) 2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerator1…ctor(String directory, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerable`1…ctor(String directory, FindTransform transform, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Directory.GetFiles(String path)
2019-01-06 17:36:01 at . ()
2019-01-06 17:36:01 — End of inner exception stack trace —
2019-01-06 17:36:01 at . ()
2019-01-06 17:36:01 at .(FontSource )
2019-01-06 17:36:01 at .()
2019-01-06 17:36:01 at .()
2019-01-06 17:36:01 at ​ .(Document , String , Stream , HtmlSaveOptions )
2019-01-06 17:36:01 at Aspose.Pdf.Document.(String , SaveOptions )
2019-01-06 17:36:01 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:36:01 at Com.Cmb.OA.Documents.Transfer.Utility.InjectInterceptor.Intercept(IInvocation invocation) in /var/jenkins_home/pl014464/Utility/InjectInterceptor.cs:line 17
2019-01-06 17:36:01 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:36:01 at Com.Cmb.OA.Documents.Transfer.Controllers.FileToHtmlController.ToHtml(IFormFile file) in /var/jenkins_home/pl014464/Controllers/FileToHtmlController.cs:line 58

I found that the API scan the folder ‘/usr/share/fonts/truetype/msttcorefonts’, but the folder is not exist in docker, and I do not have pressiom to create. I add the two code ,but it doesn’t work,because the function Clear() also scans the folder ‘/usr/share/fonts/truetype/msttcorefonts’.
Aspose.Pdf.Text.FontRepository.Sources.Clear();
Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource(@"/opt/app-root/src/"));


Unable to find an entry point named 'GdiplusStartup' in DLL 'libgdiplus
#2

@seuzc2011,

Thanks for your query.

You may please try following steps to resolve this issue for Aspose.Cells and provide your feedback.

  1. You may install “System.Drawing.Common” and “System.Text.Encoding.CodePages” for .NetStandard20 from NuGet if you refer Aspose.Cells lib manually. Or you can get Aspose.Cells from NuGet, these will be installed automatically.

  2. If it does not resolve the issue, try the following steps:

  • Install .NetCore SDK
  • Install libgdiplus
  • Copy the font files you need and call FontConfigs.SetFontFolder, please see this article i.e. Configuring Fonts for Rendering Spreadsheets
  • The installation command to install libgdiplus is as follows
sudo apt-get install libgdiplus
ln -s libgdiplus.so gdiplus.dll 
  1. Try the following command as well:
  • apt-get install libc6-dev

#3

Hello,my nuget is follow:
<PackageReference Include=“Aspose.Words” Version=“18.8.0” />

<PackageReference Include=“Aspose.Pdf” Version=“18.8.0” />

<PackageReference Include=“Aspose.Cells” Version=“18.8.0” />

<PackageReference Include=“Aspose.Slides.Net” Version=“18.8.0” />

<PackageReference Include=“Microsoft.AspNetCore.App” />

My first question is :
when I convert pdf to png or html,there is one problem.
2019-01-06 17:36:01 An unhandled exception has occurred while executing the request.
2019-01-06 17:36:01 ​ : Unexpected font parsing exception —> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘/usr/share/fonts/truetype/msttcorefonts’.
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerator 1.CreateDirectoryHandle(String path) 2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerator 1…ctor(String directory, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerable`1…ctor(String directory, FindTransform transform, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
2019-01-06 17:36:01 at System.IO.Directory.GetFiles(String path)
2019-01-06 17:36:01 at . ()
2019-01-06 17:36:01 — End of inner exception stack trace —
2019-01-06 17:36:01 at . ()
2019-01-06 17:36:01 at .(FontSource )
2019-01-06 17:36:01 at .()
2019-01-06 17:36:01 at .()
2019-01-06 17:36:01 at ​ .(Document , String , Stream , HtmlSaveOptions )
2019-01-06 17:36:01 at Aspose.Pdf.Document.(String , SaveOptions )
2019-01-06 17:36:01 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:36:01 at Com.Cmb.OA.Documents.Transfer.Utility.InjectInterceptor.Intercept(IInvocation invocation) in /var/jenkins_home/pl014464/Utility/InjectInterceptor.cs:line 17
2019-01-06 17:36:01 at Castle.DynamicProxy.AbstractInvocation.Proceed()
2019-01-06 17:36:01 at Com.Cmb.OA.Documents.Transfer.Controllers.FileToHtmlController.ToHtml(IFormFile file) in /var/jenkins_home/pl014464/Controllers/FileToHtmlController.cs:line 58

I found that the API scan the folder ‘/usr/share/fonts/truetype/msttcorefonts’, but the folder is not exist in docker, and I do not have pressiom to create. I add the two code ,but it doesn’t work,because the function Clear() also scans the folder ‘/usr/share/fonts/truetype/msttcorefonts’.
Aspose.Pdf.Text.FontRepository.Sources.Clear();
Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource(@"/opt/app-root/src/"));
Is there another way to avoid scaning the default folder ‘/usr/share/fonts/truetype/msttcorefonts’


#4

@seuzc2011

Would you please share the code snippet you are using for conversion of PDF to PNG format which results in mentioned exception, so that we my investigate further to help you out. Please also ensure using Aspose.PDF for .NET 19.1 before sharing your feedback.


#5

I have tried the last version 19.1.0,and has the same error.
the code is correct in Windows,but it has error in Docker.This is my code,which converts document to html.
public void ToHtml(IFormFile file)
{
if (fileType == “.ppt” || fileType == “.pptx”)
{
using (var stream = file.OpenReadStream())
{
Aspose.Slides.Presentation ppt = new Aspose.Slides.Presentation(stream);
ppt.Save(“ppt.html”, Aspose.Slides.Export.SaveFormat.Html);
}
}
else if (fileType == “.pdf”)
{
using (var stream = file.OpenReadStream())
{
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(stream);
pdf.Save(“pdf.html”, Aspose.Pdf.SaveFormat.Html);
}
}
else if (fileType == “.xls” || fileType == “.xlsx”)
{
using (var stream = file.OpenReadStream())
{
Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(stream);
book.Save(“cell.html”, Aspose.Cells.SaveFormat.Html);
}
}
else
{
System.Console.Writeln(“other”);
}
}


#6

@seuzc2011

Thank you for sharing the code snippet.

We have logged a ticket with ID PDFNET-45881 in our issue management system for further investigations about DirectoryNotFoundException for default folder by Aspose.PDF for .NET. We will let you know as soon as some significant updates will be available in this regard.


#7

The issues you have found earlier (filed as PDFNET-45881) have been fixed in Aspose.PDF for .NET 19.2.


#8

Are you sure?I have tried it ,but it is wrong.
2019-02-24 19:31:46 An unhandled exception has occurred while executing the request.
2019-02-24 19:31:46 System.NullReferenceException: Object reference not set to an instance of an object.
2019-02-24 19:31:46 at #=zcc765wK7jIwGGR8AFL95UnpAONdQ.#=zzI1X9Q4=(#=zy0eKz_haG2nZboKQiULPv6GLXgLZ #=zGFrw3OOWBUCU)
2019-02-24 19:31:46 at #=zw7Z5jVVA41SMVheRbU1C28E=.#=zNRJIBMk=(#=zy0eKz_haG2nZboKQiULPv6GLXgLZ #=zGFrw3OOWBUCU)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zjsfkBkzaLikkvCLKmPTSQBs=(Object #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zyfYPMUHkvVNu5iZ2P8hx8iasxba4GRLSkw==(MethodBase #=zFhSrGUc=, Boolean #=z0ddHfO4=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zEFYpYw_DANgrYg37mmVtKjkJ4VSzexhX_rdtl60=(#=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8= #=zFhSrGUc=, #=qByuF0R6LLTVKpd2ROgcRqQbTEHR8Ffq$F6Ez3U9ZrtU= #=z0ddHfO4=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zNH95uF1TQOrlOet8XuYQezpaw8JAns0q$g==()
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zlGmoxqNNCffWgYxSh0KyVOr9JrYYFqnIuA==(Boolean #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zjsfkBkzaLikkvCLKmPTSQBs=(Object #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zDTP2rbPNDVPL7Kzn30DkYnGFGPhy9Aa9ROfi8fYwzJnr()
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zGCyMom1AzK8YXm_WON_aiUjvVRR8pX2d9Q==(#=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8= #=zFhSrGUc=, #=qByuF0R6LLTVKpd2ROgcRqQbTEHR8Ffq$F6Ez3U9ZrtU= #=z0ddHfO4=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zNH95uF1TQOrlOet8XuYQezpaw8JAns0q$g==()
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zlGmoxqNNCffWgYxSh0KyVOr9JrYYFqnIuA==(Boolean #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zjsfkBkzaLikkvCLKmPTSQBs=(Object #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zDTP2rbPNDVPL7Kzn30DkYnGFGPhy9Aa9ROfi8fYwzJnr()
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zxVUyy5XJxn8g64F3DjH015RG$W0rEWXFhQ==(Object #=zFhSrGUc=, UInt32 #=z0ddHfO4=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zlGmoxqNNCffWgYxSh0KyVOr9JrYYFqnIuA==(Boolean #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zlGmoxqNNCffWgYxSh0KyVOr9JrYYFqnIuA==(Boolean #=zFhSrGUc=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zfbn_gU5GsFUX0pxm0R1MVoCxgoVF64q0Tg==()
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=ztdFrjqRdauxiyCv_1NMDaVrv5OU$RiSiBYVj9r4=(Object[] #=zFhSrGUc=, Type[] #=z0ddHfO4=, Type[] #=zY99YLTw=, Object[] #=zIIsSC3o=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=z_wwCdLBowy4yDRjvZkB9rnK_CQEyX2lzTMPQlz99OwqC(Stream #=zFhSrGUc=, String #=z0ddHfO4=, Object[] #=zY99YLTw=, Type[] #=zIIsSC3o=, Type[] #=zWMz_CO0=, Object[] #=zCX93FbE=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=zLa1XTT7WWnK9DKcyz4rO493cZweo(Stream #=zFhSrGUc=, String #=z0ddHfO4=, Object[] #=zY99YLTw=)
2019-02-24 19:31:46 at #=qdvjf$2NVHNG_WicTUAgO8fcd2Q$is6KWofUcoVjLrV8=.#=znGYpadwMtu2jXTpGEAxoiMJp8Xu_(Stream #=zFhSrGUc=, String #=z0ddHfO4=, Object[] #=zY99YLTw=)
2019-02-24 19:31:46 at Aspose.Pdf.Document.#=zX3eJbU1q9UEm(Stream #=zL5iONN8=, SaveOptions #=z$EqHIv7hQ3h1)
2019-02-24 19:31:46 at Aspose.Pdf.Document.Save(Stream outputStream, SaveFormat format)
2019-02-24 19:31:46 at Com.Cmb.OA.Documents.Transfer.Controllers.FileToImgController.PdfToPng(IFormFile file) in /var/jenkins_home/pl014464/Controllers/FileToImgController.cs:line 86


#9

@cmbch

Thank you for getting back to us.

We have recorded your feedback and will let you know as soon as any update is available in this regard.