Skip to content

PdfOptions

Namespace: PuppeteerSharp

public record PdfOptions : IEquatable<PdfOptions>

Options to be used in PdfOptions), PdfStreamAsync(PdfOptions) and PdfDataAsync(PdfOptions).

Inheritance: object

Implements: IEquatable<PdfOptions>

View source

public PdfOptions()

Initializes a new instance of the PdfOptions class.

View source

public bool DisplayHeaderFooter { get; set; }

Display header and footer. Defaults to false.

Value: bool

View source

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

View source

public PaperFormat Format { get; set; }

Paper format. If set, takes priority over Width and Height.

Value: PaperFormat

View source

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

View source

[JsonConverter(typeof(PrimitiveTypeConverter))]
public object Height { get; set; }

Paper height, accepts values labeled with units.

Value: object

View source

public bool Landscape { get; set; }

Paper orientation.. Defaults to false.

Value: bool

View source

public MarginOptions MarginOptions { get; set; }

Paper margins, defaults to none.

Value: MarginOptions

View source

public bool OmitBackground { get; set; }

Hides default white background and allows generating pdfs with transparency.

Value: bool

View source

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).

View source

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

View source

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

View source

public bool PrintBackground { get; set; }

Print background graphics. Defaults to false.

Value: bool

View source

public decimal Scale { get; set; }

Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.

Value: decimal

View source

public bool Tagged { get; set; }

Generate tagged (accessible) PDF.

Value: bool

View source

[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.

View source

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.

View source

[JsonConverter(typeof(PrimitiveTypeConverter))]
public object Width { get; set; }

Paper width, accepts values labeled with units.

Value: object

View source

Made with love by Dario Kondratiuk