|HtmlToPdf Constructor (Boolean, Encoding, String, String)|
public HtmlToPdf( bool autodetectSourceEncoding, Encoding sourceEncoding, string pdfCharset, string systemFontsFolder )
Public Sub New ( autodetectSourceEncoding As Boolean, sourceEncoding As Encoding, pdfCharset As String, systemFontsFolder As String )
This overload contains extra parameters which let you create PDF documents in non-English languages like Turkish, Hebrew, Cyrillic, and a few others. It also lets you use Windows fonts in addition to the built-in fonts which come with the library.
The default built-in fonts support only "windows-1252" charset which covers English and other Western European languages. If you need more languages or more fonts, you'll need to enable Windows fonts. Make sure that your application has permissions to read the fonts folder. Because this folder resides in Windows folder (somewhat like "C:\WINDOWS\Fonts") and your application may have limited access to it, you may need to copy the fonts you need to a separate folder which your application can read. This may be especially important for web applications.
To refer Windows fonts folder (assuming your application has permissions to read its contents), use Environment.SystemDirectory + @"\..\Fonts" in C# or Environment.SystemDirectory & "\..\Fonts" in VB.
autodetectSourceEncoding and sourceEncoding parameters lets you specify the encoding of the source data or auto-detect it if possible. pdfCharset parameter denotes the charset name of the encoding which will be used to produce the PDF document (such as "windows-1252", etc). Internally, this value is used to pick up the correct font to load. Currently, the component supports charsets specified as windows-125x (such as "windows-1251"). Charsets which cannot be specified this way are not yet supported (this includes Far East languages like Chinese and Japanese). Also, the component does not yet support right-to-left languages (Hebrew and Arabic).
In fact, pdfCharset and systemFontsFolder parameters specify how DefaultFont is created. MailBee uses systemFontsFolder when calling iTextSharp.text.FontFactory.RegisterDirectory and passes pdfCharset as second parameter when calling iTextSharp.text.FontFactory.GetFont.
The HtmlToPdf() overload of this constructor is equivalent to HtmlToPdf(true, Encoding.UTF8, null, null) (in C# syntax).
This overload requires the license key be already set (such as with MailBee.Global.LicenseKey property, app.config, web.config, or in Windows registry).