When I use Aspose.Total for .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 follows:
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 permissions 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/"));