HtmlToPdfLayoutAtPageWidth Method

Renders the HTML at the width of the page, without scaling, with the screen media type unless another media type is given. For HTML templates designed for a paper size, like invoices and reports The window keeps the width of the paper: AutoResizeBrowserWidth is set to true.

Definition

Namespace: HiQPdf.Next
Assembly: HiQPdf.Next (in HiQPdf.Next.dll) Version: 18.84.0
C#
public void LayoutAtPageWidth(
	PdfPageSize pageSize,
	PdfPageOrientation orientation = PdfPageOrientation.Portrait,
	bool preferCssPageSize = false,
	string mediaType = "screen",
	double zoom = 100,
	bool singlePage = false
)

Parameters

pageSize  PdfPageSize
The page size
orientation  PdfPageOrientation  (Optional)
Portrait or landscape
preferCssPageSize  Boolean  (Optional)
Let a @page size rule in the HTML set the page size
mediaType  String  (Optional)
The CSS media type, "screen" or "print"
zoom  Double  (Optional)
The zoom in percent, 10 to 200, at which the HTML is drawn; the window holds the width of the page at that zoom, so 100 draws one CSS pixel as 0.75 points, 80 fits more content on the page
singlePage  Boolean  (Optional)
One page as tall as the content instead of pages of the given size

Remarks

The page size, the orientation, the margins and the other options can be changed after the call: the browser window width 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

See Also