HtmlToPdfPrintLikeChrome Method

Renders the HTML the way the Chrome browser prints it to PDF: print media type, margins of 1 cm on each side and no background colors or images

Definition

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

Parameters

pageSize  PdfPageSize
The page size
orientation  PdfPageOrientation  (Optional)
Portrait or landscape
zoom  Double  (Optional)
The zoom in percent, 10 to 200, the Scale option of the Chrome print dialog
singlePage  Boolean  (Optional)
One page as tall as the content instead of pages of the given size

Remarks

The margins, PrintBackgrounds and the other options can be changed after the call; for example, setting PrintBackgrounds to true keeps the background colors and images, like the Background graphics option of Chrome. 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