Package com.microsoft.playwright
Class Page.PdfOptions
java.lang.Object
com.microsoft.playwright.Page.PdfOptions
- Enclosing interface:
Page
-
Field Summary
FieldsModifier and TypeFieldDescriptionDisplay header and footer.HTML template for the print footer.Paper format.HTML template for the print header.Paper height, accepts values labeled with units.Paper orientation.Paper margins, defaults to none.Paper ranges to print, e.g., '1-5, 8, 11-13'.The file path to save the PDF to.Give any CSS@pagesize declared in the page priority over what is declared inwidthandheightorformatoptions.Print background graphics.Scale of the webpage rendering.Paper width, accepts values labeled with units. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetDisplayHeaderFooter(boolean displayHeaderFooter) Display header and footer.setFooterTemplate(String footerTemplate) HTML template for the print footer.Paper format.setHeaderTemplate(String headerTemplate) HTML template for the print header.Paper height, accepts values labeled with units.setLandscape(boolean landscape) Paper orientation.Paper margins, defaults to none.setPageRanges(String pageRanges) Paper ranges to print, e.g., '1-5, 8, 11-13'.The file path to save the PDF to.setPreferCSSPageSize(boolean preferCSSPageSize) Give any CSS@pagesize declared in the page priority over what is declared inwidthandheightorformatoptions.setPrintBackground(boolean printBackground) Print background graphics.setScale(double scale) Scale of the webpage rendering.Paper width, accepts values labeled with units.
-
Field Details
-
format
Paper format. If set, takes priority overwidthorheightoptions. Defaults to 'Letter'. -
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
-
-
height
Paper height, accepts values labeled with units. -
landscape
Paper orientation. Defaults tofalse. -
margin
Paper margins, defaults to none. -
pageRanges
Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. -
path
The file path to save the PDF to. Ifpathis 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. -
preferCSSPageSize
Give any CSS@pagesize declared in the page priority over what is declared inwidthandheightorformatoptions. Defaults tofalse, which will scale the content to fit the paper size. -
printBackground
Print background graphics. Defaults tofalse. -
scale
Scale of the webpage rendering. Defaults to1. Scale amount must be between 0.1 and 2. -
width
Paper width, accepts values labeled with units.
-
Constructor Details
-
PdfOptions
public PdfOptions()
-
-
Method Details
-
setFormat
Paper format. If set, takes priority overwidthorheightoptions. Defaults to 'Letter'. -
setHeaderTemplate
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
-
-
setHeight
Paper height, accepts values labeled with units. -
setLandscape
Paper orientation. Defaults tofalse. -
setMargin
Paper margins, defaults to none. -
setPageRanges
Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages. -
setPath
The file path to save the PDF to. Ifpathis 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. -
setPreferCSSPageSize
Give any CSS@pagesize declared in the page priority over what is declared inwidthandheightorformatoptions. Defaults tofalse, which will scale the content to fit the paper size. -
setPrintBackground
Print background graphics. Defaults tofalse. -
setScale
Scale of the webpage rendering. Defaults to1. Scale amount must be between 0.1 and 2. -
setWidth
Paper width, accepts values labeled with units.