PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Jul 13, 2024 2:39 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Aug 18, 2011 8:49 pm 
Offline

Joined: Thu Aug 18, 2011 8:13 pm
Posts: 1
In order to use PDFSharp GDI, 1.3 in a medium trust environment I made a change to
XGraphics.cs (replacing Graphics.FromHwnd() with a call to new Bitmap())

All seems well, my Security exception is gone, but it appears that you tried
the same thing and commented it out.
What problem, if any, is there with using new Bitmap() rather than fromHwnd()?

thank you

--------------
sample code change below from XGraphics.cs:
@@ -249,14 +249,14 @@ }
page.RenderContent = content;

#if GDI
// HACK: This does not work with MediumTrust
- this.gfx = Graphics.FromHwnd(IntPtr.Zero);
- this.targetContext = XGraphicTargetContext.GDI;
//Bitmap bm = new Bitmap(10, 10);
//this.gfx = Graphics.FromImage(bm);
+ Bitmap bm = new Bitmap((int)page.Width.Point, (int)page.Height.Point);
+ this.gfx = Graphics.FromImage(bm);
#endif


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 56 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