PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 2:55 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Apr 17, 2018 4:58 pm 
Offline

Joined: Thu Feb 08, 2018 9:07 am
Posts: 7
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 17, 2018 7:29 pm 
Offline

Joined: Thu Feb 08, 2018 9:07 am
Posts: 7
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 17, 2018 9:54 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
The GDI+ build does not support IFontResolver.

See also:
http://pdfsharp.net/wiki/Private%20Fonts.ashx

PDFMigrate is off topic here.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 18, 2018 8:32 am 
Offline

Joined: Thu Feb 08, 2018 9:07 am
Posts: 7
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group