HtmlToPdfFitBrowserWindowToPage 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
The window grows to the content when the content is wider, see
AutoResizeBrowserWidth.
Namespace: HiQPdf.NextAssembly: HiQPdf.Next (in HiQPdf.Next.dll) Version: 18.84.0
public void FitBrowserWindowToPage(
PdfPageSize pageSize,
PdfPageOrientation orientation = PdfPageOrientation.Portrait,
int windowWidth = 1024,
bool singlePage = false
)
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
- singlePage Boolean (Optional)
- One page as tall as the content instead of pages of the given size
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.
The single page of the parameter can also be asked for after the call, with
AutoResizePdfPageHeight.
Setting
BrowserZoom or
BrowserWidth 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