PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 12, 2024 2:24 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: Fri Oct 09, 2009 6:15 pm 
Offline

Joined: Fri Oct 09, 2009 6:00 pm
Posts: 1
Using PDFSharp 1.30 but unable to compile the BuildAll-PdfSharp project due to an error in the deprecation of the System.Drawing.FontFamily.GetFamilies(graphics.gfx) function.

Error 1 Warning as Error: 'System.Drawing.FontFamily.GetFamilies(System.Drawing.Graphics)' is obsolete: 'Do not use method GetFamilies, use property Families instead' F:\Dev\PDFsharp\code\PdfSharp\PdfSharp.Drawing\XFontFamily.cs 268 18 PdfSharp

The MS advised workaround appears to be to use the System.Drawing.FontFamily.Families, but that assumes the current context, does not use the specified context, which might be a concern.

Here is the change I needed to make (VS 2008 SP1, Windows 7) to get a good compile

Line 268 of XFontFamily.xs commented out

//families = System.Drawing.FontFamily.GetFamilies(graphics.gfx); // error
families = System.Drawing.FontFamily.Families; // new


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 12, 2009 8:12 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
This is only a warning!
You can also turn "Treat Warnings as Error" off to compile the original source code.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 31, 2011 9:53 pm 
Offline

Joined: Thu Mar 31, 2011 9:49 pm
Posts: 2
You can solve the problem without turning off "Warning as error" this way:

Code:
#pragma warning disable 618
      families = System.Drawing.FontFamily.GetFamilies(graphics.gfx);
#pragma warning restore 618


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 23, 2011 3:09 am 
Offline

Joined: Sat Jul 23, 2011 3:03 am
Posts: 1
MarcelW, Thomas Hoevel Thanks a lot for your solution.


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: Bing [Bot], Google [Bot] 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