Table of Contents

Class PagePdfOptions

Namespace
Microsoft.Playwright
Assembly
Microsoft.Playwright.dll
public class PagePdfOptions
Inheritance
PagePdfOptions
Inherited Members

Constructors

PagePdfOptions()

public PagePdfOptions()

PagePdfOptions(PagePdfOptions)

public PagePdfOptions(PagePdfOptions clone)

Parameters

clone PagePdfOptions

Properties

DisplayHeaderFooter

Display header and footer. Defaults to false.

[JsonPropertyName("displayHeaderFooter")]
public bool? DisplayHeaderFooter { get; set; }

Property Value

bool?

FooterTemplate

HTML template for the print footer. Should use the same format as the headerTemplate.

[JsonPropertyName("footerTemplate")]
public string? FooterTemplate { get; set; }

Property Value

string

Format

Paper format. If set, takes priority over width or height options. Defaults to 'Letter'.

[JsonPropertyName("format")]
public string? Format { get; set; }

Property Value

string

HeaderTemplate

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
[JsonPropertyName("headerTemplate")]
public string? HeaderTemplate { get; set; }

Property Value

string

Height

Paper height, accepts values labeled with units.

[JsonPropertyName("height")]
public string? Height { get; set; }

Property Value

string

Landscape

Paper orientation. Defaults to false.

[JsonPropertyName("landscape")]
public bool? Landscape { get; set; }

Property Value

bool?

Margin

Paper margins, defaults to none.

[JsonPropertyName("margin")]
public Margin? Margin { get; set; }

Property Value

Margin

Outline

Whether or not to embed the document outline into the PDF. Defaults to false.

[JsonPropertyName("outline")]
public bool? Outline { get; set; }

Property Value

bool?

PageRanges

Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.

[JsonPropertyName("pageRanges")]
public string? PageRanges { get; set; }

Property Value

string

Path

The file path to save the PDF to. If path is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won't be saved to the disk.

[JsonPropertyName("path")]
public string? Path { get; set; }

Property Value

string

PreferCSSPageSize

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.

[JsonPropertyName("preferCSSPageSize")]
public bool? PreferCSSPageSize { get; set; }

Property Value

bool?

PrintBackground

Print background graphics. Defaults to false.

[JsonPropertyName("printBackground")]
public bool? PrintBackground { get; set; }

Property Value

bool?

Scale

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

[JsonPropertyName("scale")]
public float? Scale { get; set; }

Property Value

float?

Tagged

Whether or not to generate tagged (accessible) PDF. Defaults to false.

[JsonPropertyName("tagged")]
public bool? Tagged { get; set; }

Property Value

bool?

Width

Paper width, accepts values labeled with units.

[JsonPropertyName("width")]
public string? Width { get; set; }

Property Value

string