HtmlToPdfDefaultFont Property
Gets or sets default font for creating .pdf document with specified name or filename, encoding and size as iTextSharp.text.Font object.

Namespace: MailBee.Pdf
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public Font DefaultFont { get; set; }

Property Value

Type: Font
The default font is "Helvetica" with size 8 and normal style.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionvalue is a null reference (Nothing in Visual Basic).
Remarks

iTextSharp library contains the following fonts inside, which can be loaded by name:

  • Courier-Bold
  • Courier-BoldOblique
  • Courier-Oblique
  • Courier
  • Helvetica-Bold
  • Helvetica-BoldOblique
  • Helvetica-Oblique
  • Helvetica
  • Symbol
  • Times-Bold
  • Times-BoldItalic
  • Times-Italic
  • Times-Roman
  • ZapfDingbats

The internal fonts do not support multi-language encoding and thus the user should load the font which has proper encoding manually.

This property can be assigned in the following ways:

DefaultFont = FontFactory.GetFont("Helvetica", _defaultFontSize, iTextSharp.text.Font.NORMAL);
or
FontFactory.RegisterDirectory(Environment.SystemDirectory + @"\..\Fonts");
DefaultFont = FontFactory.GetFont("Arial", "windows-1255", <span style="color: blue;">true</span>, (<span style="color: blue;">float</span>)10, iTextSharp.text.Font.ITALIC);
or
BaseFont baseFont = BaseFont.CreateFont(@"C:\WINDOWS\Fonts\Arial.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
DefaultFont = <span style="color: blue;">new</span> iTextSharp.text.Font(baseFont, iTextSharp.text.Font.DEFAULTSIZE, iTextSharp.text.Font.NORMAL);
See Also