PdfOptions
Namespace: PuppeteerSharp
public record PdfOptions : IEquatable<PdfOptions>Options to be used in PdfOptions), PdfStreamAsync(PdfOptions) and PdfDataAsync(PdfOptions).
Inheritance: object
Implements: IEquatable<PdfOptions>
Constructors
Section titled “Constructors”PdfOptions()
Section titled “PdfOptions()”public PdfOptions()Initializes a new instance of the PdfOptions class.
Properties
Section titled “Properties”DisplayHeaderFooter
Section titled “DisplayHeaderFooter”public bool DisplayHeaderFooter { get; set; }Display header and footer. Defaults to false.
Value: bool
FooterTemplate
Section titled “FooterTemplate”public string FooterTemplate { get; set; }HTML template for the print footer. Should be valid HTML markup with following classes used to inject printing values into them:
date - formatted print date
title - document title
url - document location
pageNumber - current page number
totalPages - total pages in the document.
Value: string
Format
Section titled “Format”public PaperFormat Format { get; set; }Paper format. If set, takes priority over Width and Height.
Value: PaperFormat
HeaderTemplate
Section titled “HeaderTemplate”public string HeaderTemplate { get; set; }HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
date - formatted print date
title - document title
url - document location
pageNumber - current page number
totalPages - total pages in the document.
Value: string
Height
Section titled “Height”[JsonConverter(typeof(PrimitiveTypeConverter))]public object Height { get; set; }Paper height, accepts values labeled with units.
Value: object
Landscape
Section titled “Landscape”public bool Landscape { get; set; }Paper orientation.. Defaults to false.
Value: bool
MarginOptions
Section titled “MarginOptions”public MarginOptions MarginOptions { get; set; }Paper margins, defaults to none.
Value: MarginOptions
OmitBackground
Section titled “OmitBackground”public bool OmitBackground { get; set; }Hides default white background and allows generating pdfs with transparency.
Value: bool
Outline
Section titled “Outline”public bool Outline { get; set; }Generate document outline.
Value: bool
If this is enabled the PDF will also be tagged (accessible) Currently only works in old Headless (headless = true).
PageRanges
Section titled “PageRanges”public string PageRanges { get; set; }Paper ranges to print, e.g., 1-5, 8, 11-13. Defaults to the empty string, which means print all pages.
Value: string
PreferCSSPageSize
Section titled “PreferCSSPageSize”public bool PreferCSSPageSize { get; set; }Give any CSS @page size declared in the page priority over what is declared in width and height or format options.
Defaults to false, which will scale the content to fit the paper size.
Value: bool
PrintBackground
Section titled “PrintBackground”public bool PrintBackground { get; set; }Print background graphics. Defaults to false.
Value: bool
public decimal Scale { get; set; }Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
Value: decimal
Tagged
Section titled “Tagged”public bool Tagged { get; set; }Generate tagged (accessible) PDF.
Value: bool
Timeout
Section titled “Timeout”[JsonIgnore]public int? Timeout { get; set; }Timeout in milliseconds. Pass 0 to disable timeout.
Value: int?
The default value can be changed by using the DefaultTimeout property.
WaitForFonts
Section titled “WaitForFonts”public bool WaitForFonts { get; set; }If true, waits for document.fonts.ready to resolve. This might require
activating the page using BringToFrontAsync() if the page is in the
background.
Value: bool
Defaults to true.
[JsonConverter(typeof(PrimitiveTypeConverter))]public object Width { get; set; }Paper width, accepts values labeled with units.
Value: object
Made with love by Dario Kondratiuk