Click or drag to resize
Pdf Library for .NET

HtmlToPdf Constructor (Int32, Int32)

Initializes an instance of the HtmlToPdf Converter.

Namespace:  SelectPdf
Assembly:  Select.HtmlToPdf (in Select.HtmlToPdf.dll) Version: 24.1
Syntax
public HtmlToPdf(
	int webPageWidth,
	int webPageHeight
)

Parameters

webPageWidth
Type: SystemInt32
Width in pixels of the internal browser that renders the web page.
webPageHeight
Type: SystemInt32
Height 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 of the page specified by the webPageHeight parameter. The width and height can be also set using WebPageWidth and WebPageHeight properties of Options property.

If webPageHeight is set, the web page will be truncated to the specified height. Usually, webPageHeight should be set to 0 to determine the converter to automatically calculate the page height, but there are some situations (web pages with frames for example) when the converter cannot calculate the page height correctly. In this case, webPageHeight 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, height);
PdfDocument doc = converter.ConvertUrl(url);
doc.Save(file);
doc.Close();
See Also