Generates a PDF of the page with the print CSS media type
Usage Example:
mutation GeneratePDF {
goto(url: "https://example.com", waitUntil: firstMeaningfulPaint) {
status
}
simple: pdf {
base64
}
customArgs: pdf(
format: a5
displayHeaderFooter: true
headerTemplate: "<span style=\"font-size: 16pt;\">Hello World</span>"
) {
base64
}
}
Field Definition:
pdf(
displayHeaderFooter: Boolean
format: PDFPageFormat
footerTemplate: String
generateDocumentOutline: Boolean
generateTaggedPDF: Boolean
landscape: Boolean
printBackground: Boolean
scale: Float
timeout: Float
waitForImages: Boolean
width: FloatOrString
headerTemplate: String
height: FloatOrString
marginBottom: FloatOrString
marginLeft: FloatOrString
marginRight: FloatOrString
marginTop: FloatOrString
pageRanges: String
preferCSSPageSize: Boolean
transferMode: String
): PDFResponse
Arguments
pdf.displayHeaderFooter ● Boolean scalar
Display header and footer. Defaults to false
pdf.format ● PDFPageFormat enum
The page format to use for the PDF
pdf.footerTemplate ● String scalar
HTML template for the print footer. Should use the same format as the headerTemplate.
pdf.generateDocumentOutline ● Boolean scalar
Whether or not to embed the document outline into the PDF
pdf.generateTaggedPDF ● Boolean scalar
Whether or not to generate tagged (accessible) PDF. Defaults to embedded choice
pdf.landscape ● Boolean scalar
Paper orientation. Defaults to false
pdf.printBackground ● Boolean scalar
Print background graphics. Defaults to false
pdf.scale ● Float scalar
Scale of the webpage rendering. Defaults to 1
pdf.timeout ● Float scalar
The maximum amount of time, in milliseconds, to wait for the PDF to be generated. Default timeout is 30 seconds, or 30000.
pdf.waitForImages ● Boolean scalar
When true, waits for all images on the page to load before generating the PDF. Default: False
pdf.width ● FloatOrString scalar
Width in inches or CSS unit. Defaults to 8.5 inches
pdf.headerTemplate ● String scalar
HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:
date: formatted print datetitle: document titleurl: document locationpageNumber: current page numbertotalPages: total pages in the document
For example, <span class=title></span> would generate span containing the title
pdf.height ● FloatOrString scalar
Height in inches or CSS unit. Defaults to 11 inches
pdf.marginBottom ● FloatOrString scalar
Bottom margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
pdf.marginLeft ● FloatOrString scalar
Left margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
pdf.marginRight ● FloatOrString scalar
Right margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
pdf.marginTop ● FloatOrString scalar
Top margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
pdf.pageRanges ● String scalar
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
pdf.preferCSSPageSize ● Boolean scalar
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
pdf.transferMode ● String scalar
Return as stream (PrintToPDFRequestTransferMode enum)
Type
PDFResponse object
The response returned after generating a PDF