PdfTemplating.XslFO icon indicating copy to clipboard operation
PdfTemplating.XslFO copied to clipboard

User32.dll dependency on linux

Open AlexSchuetz opened this issue 4 years ago • 4 comments

Running our project on linux we get the following error:

PdfTemplating.XslFO.XslFORenderException: Error occurred while rendering the XslFO into Pdf File output. --->
PdfTemplating.XslFO.XslFORenderException: System.DllNotFoundException: Unable to load shared library 'User32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable:
libUser32.dll: cannot open shared object file: No such file or directory
   at Fonet.Pdf.Gdi.LibWrapper.GetDC(IntPtr hWnd)
   at Fonet.Pdf.Gdi.GdiDeviceContent..ctor()
   at Fonet.Render.Pdf.FontSetup.AddSystemFonts(FontType fontType)
   at Fonet.Render.Pdf.FontSetup..ctor(FontInfo fontInfo, FontType proxyFontType)
   at Fonet.Render.Pdf.PdfRenderer.SetupFontInfo(FontInfo fontInfo)
   at Fonet.StreamRenderer.StartRenderer()
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
   at PdfTemplating.XslFO.Fonet.CustomExtensions.XslFOFonetHelper.<>c__DisplayClass3_0.<Render>b__2(Object sender, FonetEventArgs eventArgs)
   at Fonet.FonetDriver.FireFonetError(String message)
   at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader)
   at Fonet.FonetDriver.Render(XmlReader inputReader, Stream outputStream)
   at PdfTemplating.XslFO.Fonet.CustomExtensions.XslFOFonetHelper.Render(XDocument xXslFODoc, Stream outputStream, XslFORenderOptions options)
   at PdfTemplating.XslFO.Fonet.CustomExtensions.XslFONetXDocumentCustomExtensions.RenderXslFOToPdf(XDocument xXslFODoc, XslFORenderOptions options)

AlexSchuetz avatar Nov 17 '20 10:11 AlexSchuetz

Obviously the following dlls are required:

  • User32.dll
  • gdi32.dll

I think both of them are windows-only dlls. These dependencies should be replaced or at least be listed in the dependencies of the nuget package.

AlexSchuetz avatar Nov 17 '20 12:11 AlexSchuetz

@AlexSchuetz sorry for the delayed response. I will have to look more closely into this, but you may be correct. I have never tried executing the FO.Net (cloned from original CodePlex) in a Linux deployment. Though the code does compile and run fine as .Net core port....

I'll leave this issue open until I have time to further look into this. But, that is why I've shifted to using a PDF as a Service approach using true Apache FOP via AzureFunctions deployment....

A ready to deploy project is here: https://github.com/cajuncoding/ApacheFOP.Serverless

And a Branch of this project PdfTemplating.XslFO that implements a new use case leveraging the ApacheFOP.Serverless is located here: https://github.com/cajuncoding/PdfTemplating.XslFO/tree/feature/iniial_support_for_apache_fop_serverless_rendering

cajuncoding avatar Dec 02 '20 22:12 cajuncoding

I'll have a look at the serviceaproach, thank's.

Meanwhile my collegue lokked into this and found out, that wine comes with a user32 and gdi32 implementation. Do you have any ideas on how to use these?

AlexSchuetz avatar Dec 04 '20 15:12 AlexSchuetz

@AlexSchuetz unfortunately I'm not familiar with the use of wine, but that is interesting. If you make any progress on that, I'd love to hear about it.

I generally have always used .Net, and still am with my current client whereby we will likely deploy the ApacheFOP.Serverless for in January/Feb when they prioritize for us to replace existing legacy Crystal Reports based PDF reports...

I'll try to find time to push a Nuget update with dependencies updated soon -- Thanks for the Feedback!

Good Luck!

cajuncoding avatar Dec 05 '20 09:12 cajuncoding