Articles in this section

How to handle the GDI restriction of Windows azure when creating the PDF document?

Windows azure web application doesn’t have the elevated permission to access the system fonts, so you can face unexpected exceptions when generating the ASP.NET WebForms PDF  document. You can work around this by attaching the TTF fonts with the Web application and access it in the program. Please refer the below code snippet for the same.

C#

//Creating the new PDF document
PdfDocument doc = new PdfDocument();
doc.PageSettings.Size = PdfPageSize.Letter;
doc.PageSettings.Orientation = PdfPageOrientation.Portrait;
 
PdfPage page = doc.Pages.Add();
PdfColor color = new PdfColor(System.Drawing.Color.Black);
PdfSolidBrush brushBlack = new PdfSolidBrush(color);
 
//Creating the new font from the TTF file
PdfFont font = new PdfTrueTypeFont(Server.MapPath(@"~/App_Data/calibri.ttf"), 24, PdfFontStyle.Regular);
 
page.Graphics.DrawString("Hello World", font, PdfBrushes.Red, 0, 0);
 
//Save the PDF document
doc.Save("sample.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save);
 
//Close the PDF document
doc.Close(true);

 

Sample project:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/PDFFontTest827240610


Note:

A new version of Essential Studio® for ASP.NET is available. Versions prior to the release of Essential Studio® 2014, Volume 2 will now be referred to as classic versions. The new ASP.NET suite is powered by Essential Studio for JavaScript, providing client-side rendering of HTML5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio® for ASP.NET. Although Syncfusion® will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forums or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied