<titledata-rh="true">PDFOptions interface | Puppeteer</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://pptr.dev/next/api/puppeteer.pdfoptions"><metadata-rh="true"property="og:locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="docsearch:counter"content="3"><metadata-rh="true"property="og:title"content="PDFOptions interface | Puppeteer"><metadata-rh="true"name="description"content="Valid options to configure PDF generation via Page.pdf()."><metadata-rh="true"property="og:description"content="Valid options to configure PDF generation via Page.pdf()."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/next/api/puppeteer.pdfoptions"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.pdfoptions"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.pdfoptions"hreflang="x-default"><linkdata-rh="true"rel="preconnect"href="https://DVKY664LG7-dsn.algolia.net"crossorigin="anonymous"><linkrel="search"type="application/opensearchdescription+xml"title="Puppeteer"href="/opensearch.xml">
<p>Valid options to configure PDF generation via <ahref="/next/api/puppeteer.page.pdf">Page.pdf()</a>.</p>
<h4class="anchor anchorWithStickyNavbar_LWe7"id="signature">Signature:<ahref="#signature"class="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"></a></h4>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="properties">Properties<ahref="#properties"class="hash-link"aria-label="Direct link to Properties"title="Direct link to Properties"></a></h2>
<table><thead><tr><th>Property</th><th>Modifiers</th><th>Type</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td>displayHeaderFooter</td><td><code>optional</code></td><td>boolean</td><td>Whether to show the header and footer.</td><td><code>false</code></td></tr><tr><td>footerTemplate</td><td><code>optional</code></td><td>string</td><td>HTML template for the print footer. Has the same constraints and support for special classes as <ahref="/next/api/puppeteer.pdfoptions">PDFOptions.headerTemplate</a>.</td><td></td></tr><tr><td>format</td><td><code>optional</code></td><td><ahref="/next/api/puppeteer.paperformat">PaperFormat</a></td><td></td><td><code>letter</code>.</td></tr><tr><td>headerTemplate</td><td><code>optional</code></td><td>string</td><td><p>HTML template for the print header. Should be valid HTML with the following classes used to inject values into them:</p><p>- <code>date</code> formatted print date</p><p>- <code>title</code> document title</p><p>- <code>url</code> document location</p><p>- <code>pageNumber</code> current page number</p><p>- <code>totalPages</code> total pages in the document</p></td><td></td></tr><tr><td>height</td><td><code>optional</code></td><td>string | number</td><td>Sets the height of paper. You can pass in a number or a string with a unit.</td><td></td></tr><tr><td>landscape</td><td><code>optional</code></td><td>boolean</td><td>Whether to print in landscape orientation.</td><td><code>false</code></td></tr><tr><td>margin</td><td><code>optional</code></td><td><ahref="/next/api/puppeteer.pdfmargin">PDFMargin</a></td><td>Set the PDF margins.</td><td><code>undefined</code> no margins are set.</td></tr><tr><td>omitBackground</td><td><code>optional</code></td><td>boolean</td><td>Hides default white background and allows generating pdfs with transparency.</td><td><code>false</code></td></tr><tr><td>pageRanges</td><td><code>optional</code></td><td>string</td><td>Paper ranges to print, e.g. <code>1-5, 8, 11-13</code>.</td><td>The empty string, which means all pages are printed.</td></tr><tr><td>path</td><td><code>optional</code></td><td>string</td><td>The path to save the file to.</td><td><code>undefined</code>, which means the PDF will not be written to disk.</td></tr><tr><td>preferCSSPageSize</td><td><code>optional</code></td><td>boolean</td><td>Give any CSS <code>@page</code> size declared in the page priority over what is declared in the <code>width</code> or <code>height</code> or <code>format</code> option.</td><td><code>false</code>, which will scale the content to fit the paper size.</td></tr><tr><td>printBackground</td><td><code>optional</code></td><td>boolean</td><td>Set to <code>true</code> to print background graphics.</td><td><code>false</code></td></tr><tr><td>scale</td><td><code>optional</code></td><td>number</td><td>Scales the rendering of the web page. Amount must be between <code>0.1</code> and <code>2</code>.</td><td><code>1</code></td></tr><tr><td>tagged</td><td><code>optional</code></td><td>boolean</td><td>Generate tagged (accessible) PDF.</td><td><code>false</code></td></tr><tr><td>timeout</td><td><code>optional</code></td><td>number</td><td>Timeout in milliseconds. Pass <code>0</code> to disable timeout.</td><td><code>30_000</code></td></tr><tr><td>width</td><td><code>optional</code></td><td>string | number</td><td>Sets the width of paper. You can pass in a number or a string with a unit.</td><td></td></tr></tbody></table></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--prev"href="/next/api/puppeteer.pdfmargin"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">PDFMargin</div></a><aclass="pagination-nav__link pagination-nav__link--next"href="/next/api/puppeteer.permission"><divclass="pagination-nav__sublabel">Next</div><divclass="pagination-nav__label">Permission</div></a></nav></div></div><divclass="col col--3"><divclass="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ulclass="table-of-contentstable-of-conte