Click or drag to resize
Pdf Library for .NET

HtmlToPdf Constructor (Int32)

Initializes an instance of the HtmlToPdf Converter.

Namespace:  SelectPdf
Assembly:  Select.Pdf (in Select.Pdf.dll) Version: 20.2
Syntax
public HtmlToPdf(
	int webPageWidth
)

Parameters

webPageWidth
Type: SystemInt32
Width in pixels of the internal browser that renders the web page.
Remarks
The web page is rendered by an internal browser having the width specified by the webPageWidth parameter and the height automatically calculated. The width and height can be also set using WebPageWidth and WebPageHeight properties of Options property.

Usually, the web page height does not need to be set and the converter automatically calculates it, but there are some situations (web pages with frames for example) when the converter cannot calculate the page height correctly. In this case, the web page 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(width);
PdfDocument doc = converter.ConvertUrl(url);
doc.Save(file);
doc.Close();
See Also