Table of Contents

Class PrintToPDFCommandSettings

Namespace
OpenQA.Selenium.DevTools.V146.Page
Assembly
Selenium.WebDriver.dll

Print page as PDF.

public sealed class PrintToPDFCommandSettings : ICommand
Inheritance
PrintToPDFCommandSettings
Implements
Inherited Members

Properties

CommandName

Gets the name of the command.

[JsonIgnore]
public string CommandName { get; }

Property Value

string

DisplayHeaderFooter

Display header and footer. Defaults to false.

[JsonPropertyName("displayHeaderFooter")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
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")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? FooterTemplate { get; set; }

Property Value

string

GenerateDocumentOutline

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

[JsonPropertyName("generateDocumentOutline")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? GenerateDocumentOutline { get; set; }

Property Value

bool?

GenerateTaggedPDF

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

[JsonPropertyName("generateTaggedPDF")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? GenerateTaggedPDF { get; set; }

Property Value

bool?

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

For example, <span class=title></span> would generate span containing the title.

[JsonPropertyName("headerTemplate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? HeaderTemplate { get; set; }

Property Value

string

Landscape

Paper orientation. Defaults to false.

[JsonPropertyName("landscape")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? Landscape { get; set; }

Property Value

bool?

MarginBottom

Bottom margin in inches. Defaults to 1cm (~0.4 inches).

[JsonPropertyName("marginBottom")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? MarginBottom { get; set; }

Property Value

double?

MarginLeft

Left margin in inches. Defaults to 1cm (~0.4 inches).

[JsonPropertyName("marginLeft")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? MarginLeft { get; set; }

Property Value

double?

MarginRight

Right margin in inches. Defaults to 1cm (~0.4 inches).

[JsonPropertyName("marginRight")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? MarginRight { get; set; }

Property Value

double?

MarginTop

Top margin in inches. Defaults to 1cm (~0.4 inches).

[JsonPropertyName("marginTop")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? MarginTop { get; set; }

Property Value

double?

PageRanges

Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. The page numbers are quietly capped to actual page count of the document, and ranges beyond the end of the document are ignored. If this results in no pages to print, an error is reported. It is an error to specify a range with start greater than end.

[JsonPropertyName("pageRanges")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? PageRanges { get; set; }

Property Value

string

PaperHeight

Paper height in inches. Defaults to 11 inches.

[JsonPropertyName("paperHeight")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? PaperHeight { get; set; }

Property Value

double?

PaperWidth

Paper width in inches. Defaults to 8.5 inches.

[JsonPropertyName("paperWidth")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? PaperWidth { get; set; }

Property Value

double?

PreferCSSPageSize

Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.

[JsonPropertyName("preferCSSPageSize")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? PreferCSSPageSize { get; set; }

Property Value

bool?

PrintBackground

Print background graphics. Defaults to false.

[JsonPropertyName("printBackground")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? PrintBackground { get; set; }

Property Value

bool?

Scale

Scale of the webpage rendering. Defaults to 1.

[JsonPropertyName("scale")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? Scale { get; set; }

Property Value

double?

TransferMode

return as stream

[JsonPropertyName("transferMode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? TransferMode { get; set; }

Property Value

string