Click or drag to resize
Pdf Library for .NET

HtmlToPdf Constructor

Initializes an instance of the HtmlToPdf Converter.

Namespace:  SelectPdf
Assembly:  Select.HtmlToPdf (in Select.HtmlToPdf.dll) Version: 23.1
Syntax
public HtmlToPdf()
Remarks
The web page is rendered by an internal browser having the default width of 1024px. The height of the page is automatically calculated. The width and height can be set using WebPageWidth and WebPageHeight properties of Options property.

Usually, the web page width and height do not need to be set and the converter automatically calculates them, but there are some situations (web pages with frames for example) when the converter cannot calculate the page size correctly. In this case, the web page width and height needs to be set, otherwise no content will appear in the generated pdf document.

Examples
The following sample code shows how an HtmlToPdf Converter can be instantiated and a basic conversion performed.
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl(url);
doc.Save(file);
doc.Close();
See Also