HtmlToPdf Class
Provides methods and properties for HTML to PDF conversion.
Inheritance Hierarchy
SystemObject
  MailBee.PdfHtmlToPdf

Namespace: MailBee.Pdf
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public class HtmlToPdf

The HtmlToPdf type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleHtmlToPdf
Creates an instance of HtmlToPdf class.
Public methodHtmlToPdf(String)
Creates and unlocks an instance of HtmlToPdf class.
Public methodCode exampleHtmlToPdf(Boolean, Encoding, String, String)
Creates an instance of HtmlToPdf class for use with international charsets.
Top
Methods
  NameDescription
Public methodCode exampleConvert(Stream, Stream)
Writes an HTML or plain-text string into a stream in PDF format.
Public methodCode exampleConvert(Stream, String)
Writes an HTML or plain-text string into the file in PDF format.
Public methodCode exampleConvert(String, Stream)
Writes an HTML or plain-text string into a stream in PDF format.
Public methodCode exampleConvert(String, String)
Writes an HTML or plain-text string into the file in PDF format.
Public methodCode exampleConvert(Uri, Stream)
Converts HTML, plain text or XML document denoted by the specified URI into the stream in PDF format.
Public methodCode exampleConvert(Uri, String)
Converts HTML, plain text or XML document denoted by the specified URI into the file in PDF format.
Public methodCode exampleConvertFile(String, Stream)
Writes the file with HTML or plain-text string into a stream in PDF format.
Public methodCode exampleConvertFile(String, String)
Writes the file with HTML or plain-text string into the file in PDF format.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyDefaultFont
Gets or sets default font for creating .pdf document with specified name or filename, encoding and size as iTextSharp.text.Font object.
Public propertyDefaultFontSize
Gets or sets font size for the internal default font.
Public propertyStatic memberLicenseKey Obsolete.
Assigns the license key.
Public propertyCode exampleOnConvertXmlNodeToPdf
Gets or sets the application-supplied method for fine-tuning of source to PDF conversion.
Public propertyOnProcessImagePath
Gets or sets the application-supplied method for changing path or URI or URL to the image.
Public propertyPageRectangle
Gets or sets page size of .pdf document as iTextSharp.text.Rectangle object.
Public propertySourceType
Gets or sets the format of the input data for the conversion.
Public propertyTrialDaysLeft
Gets the number of days left to the date of the trial license key expiration.
Public propertyUseBlackAndWhiteStyle
Enables conversion of colored HTML document to black and white PDF document.
Top
Remarks

This class is capable of converting table-based HTML/XHTML documents (like invoices and reports) or plain-text into PDF format. For HTML, only the most common CSS styles are supported. The component, however, provides OnConvertXmlNodeToPdf delegate which allows you to fine-tune the conversion process by adjusting colors, alignment, fonts, or with direct emitting PDF content.

Prior to creating instances of this class, the correct license key must be set. See MailBee.Global.LicenseKey property for details.

Note Note
This class uses iTextSharp and HtmlAgilityPack open source libraries to make HTML be XHTML compliant and build actual PDF content. If you're using HtmlToPdf class, you'll also need to copy the corresponding .DLLs with your application. By default, iTextSharp and HtmlAgilityPack .DLLs reside at the same location where MailBee.NET.dll itself.
Note Note
This class is not supported in .NET Core and UWP apps.
Examples
See Also