PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 6:14 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
 Post subject: Security Problem
PostPosted: Tue Nov 03, 2009 1:44 pm 
Offline

Joined: Tue Nov 03, 2009 1:33 pm
Posts: 4
Hi I'm a bit new to both asp.net and pdfSharp.

I'm trying to make some report pdf's and everything is nice and good. But now have I moved from my local server to the developing server, and have meet some issues.

I get a security exception:
Code:
Exception Details: System.Security.SecurityException: System.Security.Permissions.SecurityPermission

XFont pdfTitle = new XFont("Arial", 20, XFontStyle.BoldItalic);

I know I might solve this by changing the permissions.

But I would like to use the fonts from an external folder e.g ~/Resources/Fonts/
So I don't have to make the site more unsecured, due to some fonts.

How do I accomplish this? Any help would really be appreciated :)

And thx for the good library :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Security Problem
PostPosted: Tue Nov 03, 2009 2:53 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

You can use a PrivateFontCollection to avoid this.

Using PDFsharp 1.3, PrivateFontCollection works in the WPF build.

Using PDFsharp 1.2, PrivateFontCollection works in the GDI+ build.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Security Problem
PostPosted: Tue Nov 03, 2009 2:57 pm 
Offline

Joined: Tue Nov 03, 2009 1:33 pm
Posts: 4
Sorry not to make everything more complicated. But I have just used the standard font from asp.net, to what seems, to be without problems:

Code:
Font pdfTitle = new Font("Arial", 20, FontStyle.Bold);
Font heading1 = new Font("Arial", 14, FontStyle.Bold);
Font heading2 = new Font("Arial", 12, FontStyle.Bold);
Font normal = new Font("Arial", 12, FontStyle.Regular);


But now I get another security problem:

Code:
XGraphics gfx = XGraphics.FromPdfPage(page);

And the stack if it helps:
Code:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +54
   System.Drawing.Graphics.FromHwnd(IntPtr hwnd) +66
   PdfSharp.Drawing.XGraphics..ctor(PdfPage page, XGraphicsPdfPageOptions options, XGraphicsUnit pageUnit, XPageDirection pageDirection) +404
   PdfSharp.Drawing.XGraphics.FromPdfPage(PdfPage page) +53
   ReportGenerator.createPdf() in c:\projekter\truckid\TruckIDWeb\App_Code\ReportGenerator.cs:137
   Reports_UserReports.Button1_Click(Object sender, EventArgs e) in c:\projekter\truckid\TruckIDWeb\Reports\UserReports.aspx.cs:98
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11041511
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11041050
   System.Web.UI.Page.ProcessRequest() +91
   System.Web.UI.Page.ProcessRequest(HttpContext context) +240
   ASP.reports_userreports_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\truckidweb\1ee09bba\44640288\App_Web_zkh0ouwy.2.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171


So I really don't understand what there's going on? I would really like to get enlighten on this one :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Security Problem
PostPosted: Tue Nov 03, 2009 3:10 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
See also here:
http://www.pdfsharp.net/wiki/PDFsharpFA ... um_Trust_5

_________________
Regards
Thomas Hoevel
PDFsharp Team


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 393 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