PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
PDFMigrate v1.5.1 under mono https://forum.pdfsharp.net/viewtopic.php?f=2&t=3766 |
Page 1 of 1 |
Author: | garycuthbert [ Tue Apr 17, 2018 4:58 pm ] |
Post subject: | PDFMigrate v1.5.1 under mono |
Hello, I pulled the NuGet package PDFMigrate v1.5.1 which contains the following: MigraDoc.DocumentObjectModel-gdi.dll v1.50.4589.0 MigraDoc.Rendering-gdi.dll v1.50.4589.0 PdfSharp.Charting-gdi.dll v1.50.4589.0 PdfSharp-gdi.dll v1.50.4589.0 I have implemented a solution using the above which functions under windows however when built under mono and run in a linux environment I get an exception 'EntryPointNotFoundException: GetDC' at (wrapper managed-to-native) PdfSharp.Internal.NativeMethod:GetDC at PdfSharp.Drawing.XFontSource.ReadFontBytesFromGdi when i call the 'RenderDocument' method of my PdfDocumentRenderer. I have been trying to develop a solution that works under windows and linux environments, i had originally attempted to load private fonts under mono but, having posted a question on the forum (http://forum.pdfsharp.net/viewtopic.php?f=2&t=3730), understood that this was not supported on the PDFMigrate v1.5.1 release. At that time i am sure i had some sort of report generating under mono using the default system font but i am starting to doubt this, i may just have had some code to create fonts but not render anything. Looking at the implementation of PdfSharp.InternalNativeMethod GetDC in 'NativeMethods.cs' i can see that it is importing it from user32.dll which presumably mono will not have. Code: [DllImport("user32.dll")] public static extern IntPtr GetDC(IntPtr hwnd); Has anyone had any success generating a pdf using migradoc under mono with the PDFMigrate release? Thanks for reading |
Author: | garycuthbert [ Tue Apr 17, 2018 7:29 pm ] |
Post subject: | Re: PDFMigrate v1.5.1 under mono |
Further to this, I understand that if i can use IFontResolver i can avoid using the GetDC call however the GDI build doesn't support IFontResolver, does the latest GDI+ build support IFontResolver? if so i may be able to use this, it seems to have a compatible API under mono. many thanks |
Author: | TH-Soft [ Tue Apr 17, 2018 9:54 pm ] |
Post subject: | Re: PDFMigrate v1.5.1 under mono |
The GDI+ build does not support IFontResolver. See also: http://pdfsharp.net/wiki/Private%20Fonts.ashx PDFMigrate is off topic here. |
Author: | garycuthbert [ Wed Apr 18, 2018 8:32 am ] |
Post subject: | Re: PDFMigrate v1.5.1 under mono |
Thanks, it looks like there is no suitable build that will work under mono that supports IFontResolver. If there was a build that supported XPrivateFontCollection would that mechanism avoid the use of GetDC? This approach will have other issues as font file locations are difficult to pin down on linux distributions but if it avoids the GetDC calls then it would be worth pursuing. Gary |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |