Click or drag to resize
Pdf Library for .NET

HtmlToPdfOptionsWebPageWidth Property

Gets or sets the width of the converted web page as it would appear in the internal browser used to render the html.

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.5
Syntax
public int WebPageWidth { get; set; }

Property Value

Int32
Remarks
The web page width is specified in pixels and the default value is 1024px.

The page is laid out the way a browser window this wide lays it out, and the result is scaled so that this width fills the width of the pdf page between the margins: a smaller width produces larger content in the pdf, a larger width smaller content.

Content wider than this width is cut at the right edge, as a browser cuts it when it prints: to keep a wide table or a long preformatted line, let the page lay it out narrower (for example white-space: pre-wrap or a narrower table) or raise this width to the width the content needs, or set FitWideContent to true to lay the page out at the width the content needs and scale it down to the pdf page.

The width applies with CssMediaType set to print as well, so a page that brings its own print stylesheet is laid out this wide and scaled to the page - smaller than a browser prints it. To print such a page at 100%, set this to the width of the paper between the margins in pixels, at 96 pixels per inch: 793 for an A4 page in portrait with no margins.

A value of 0 or less uses the default width.

This property can also be set directly in the constructor of HtmlToPdf class.

See Also