HtmlToPdfConverterFitBrowserWindowToPage Method

Renders the HTML in a browser window of the given width and scales the result to fit the page width, reducing it on a page narrower than the window and enlarging it on a wider one. The scale is computed when the PDF is generated, from the page size, the orientation and the margins. To render at the page width without scaling, use LayoutAtPageWidth. This is the layout of a new converter, with an A4 page in portrait orientation and a 1024 pixel browser window

Definition

Namespace: EvoPdf.Next
Assembly: EvoPdf.Next (in EvoPdf.Next.dll) Version: 14.75.0
C#
public void FitBrowserWindowToPage(
	PdfPageSize pageSize,
	PdfPageOrientation orientation = PdfPageOrientation.Portrait,
	int windowWidth = 1024
)

Parameters

pageSize  PdfPageSize
The page size
orientation  PdfPageOrientation  (Optional)
Portrait or landscape
windowWidth  Int32  (Optional)
The browser window width in pixels: 1024 for the desktop layout of a page, 412 for its phone layout

Remarks

The page size, the orientation, the margins and the other options can be changed after the call: the zoom is computed from them when the PDF is generated. Setting HtmlViewerZoom or HtmlViewerWidth after the call ends the automatic layout: the values set are used as they are, without adjusting them to the page, until a layout method is called again. The layouts for the usual cases are described in the "HTML to PDF Page Setup and Scaling" topic: HTML to PDF Page Setup and Scaling

See Also