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