For AI agents: a documentation index is available at /llms.txt
Skip to main content

PDFOptions

Properties

PropertyTypeDescription
displayHeaderFooter?booleanDisplay header and footer. Defaults to false
footerTemplate?stringHTML template for the print footer. Should use the same format as the headerTemplate.
format?PDFPageFormatThe page format to use for the PDF
fullPage?booleanWhen true, sizes the PDF page height to the full scroll height of the document so the entire page renders on a single page. Mutually exclusive with "format" and "height". Default: False
generateDocumentOutline?booleanWhether or not to embed the document outline into the PDF
generateTaggedPDF?booleanWhether or not to generate tagged (accessible) PDF. Defaults to embedded choice
headerTemplate?stringHTML 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
height?string | numberHeight in inches or CSS unit. Defaults to 11 inches
landscape?booleanPaper orientation. Defaults to false
marginBottom?string | numberBottom margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
marginLeft?string | numberLeft margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
marginRight?string | numberRight margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
marginTop?string | numberTop margin in inches or CSS unit. Defaults to 1cm (~0.4 inches).
omitBackground?booleanHides the default white background and allows the PDF to preserve transparency. Defaults to false.
pageRanges?stringPaper 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
path?string-
preferCSSPageSize?booleanWhether 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
printBackground?booleanPrint background graphics. Defaults to false
scale?numberScale of the webpage rendering. Defaults to 1
timeout?numberThe maximum amount of time, in milliseconds, to wait for the PDF to be generated. Default timeout is 30 seconds, or 30000.
transferMode?stringReturn as stream (PrintToPDFRequestTransferMode enum)
waitForFonts?booleanWhen true, waits for document fonts to finish loading before generating the PDF. Default: False
waitForImages?booleanWhen true, waits for all images on the page to load before generating the PDF. Default: False
width?string | numberWidth in inches or CSS unit. Defaults to 8.5 inches