<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">
<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><p>Property</p></th><th><p>Modifiers</p></th><th><p>Type</p></th><th><p>Description</p></th><th><p>Default</p></th></tr></thead><tbody><tr><td><p>displayHeaderFooter</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Whether to show the header and footer.</p></td><td><p><code>false</code></p></td></tr><tr><td><p>footerTemplate</p></td><td><p><code>optional</code></p></td><td><p>string</p></td><td><p>HTML template for the print footer. Has the same constraints and support for special classes as <ahref="/next/api/puppeteer.pdfoptions">PDFOptions.headerTemplate</a>.</p></td><td></td></tr><tr><td><p>format</p></td><td><p><code>optional</code></p></td><td><p><ahref="/next/api/puppeteer.paperformat">PaperFormat</a></p></td><td></td><td><p><code>letter</code>.</p></td></tr><tr><td><p>headerTemplate</p></td><td><p><code>optional</code></p></td><td><p>string</p></td><td><p>HTML template for the print header. Should be valid HTML with the following classes used to inject values into them:</p><ul>
<li>
<p><code>date</code> formatted print date</p>
</li>
<li>
<p><code>title</code> document title</p>
</li>
<li>
<p><code>url</code> document location</p>
</li>
<li>
<p><code>pageNumber</code> current page number</p>
</li>
<li>
<p><code>totalPages</code> total pages in the document</p>
</li>
</ul></td><td></td></tr><tr><td><p>height</p></td><td><p><code>optional</code></p></td><td><p>string | number</p></td><td><p>Sets the height of paper. You can pass in a number or a string with a unit.</p></td><td></td></tr><tr><td><p>landscape</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Whether to print in landscape orientation.</p></td><td><p><code>false</code></p></td></tr><tr><td><p>margin</p></td><td><p><code>optional</code></p></td><td><p><ahref="/next/api/puppeteer.pdfmargin">PDFMargin</a></p></td><td><p>Set the PDF margins.</p></td><td><p><code>undefined</code> no margins are set.</p></td></tr><tr><td><p>omitBackground</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Hides default white background and allows generating pdfs with transparency.</p></td><td><p><code>false</code></p></td></tr><tr><td><p>outline</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Generate document outline.</p></td><td><p><code>false</code></p></td></tr><tr><td><p>pageRanges</p></td><td><p><code>optional</code></p></td><td><p>string</p></td><td><p>Paper ranges to print, e.g. <code>1-5, 8, 11-13</code>.</p></td><td><p>The empty string, which means all pages are printed.</p></td></tr><tr><td><p>path</p></td><td><p><code>optional</code></p></td><td><p>string</p></td><td><p>The path to save the file to.</p></td><td><p><code>undefined</code>, which means the PDF will not be written to disk.</p></td></tr><tr><td><p>preferCSSPageSize</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>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.</p></td><td><p><code>false</code>, which will scale the content to fit the paper size.</p></td></tr><tr><td><p>printBackground</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Set to <code>true</code> to print background graphics.</p></td><td><p><code>false</code></p></td></tr><tr><td><p>scale</p></td><td><p><code>optional</code></p></td><td><p>number</p></td><td><p>Scales the rendering of the web page. Amount must be between <code>0.1</code> and <code>2</code>.</p></td><td><p><code>1</code></p></td></tr><tr><td><p>tagged</p></td><td><p><code>optional</code></p></td><td><p>boolean</p></td><td><p>Generate tagged (accessible) PDF.</p></td><td><p><code>true</code></p></td></tr><tr><td><p>timeout</p></td><td><p><code>optional</code></p></td><td><p>number</p></td><td><p>Timeout in milliseconds. Pass <code>0</code> to disable timeout.</p></td><td><p><code>30_000</code></p></td></tr><tr><td><p>width</p></td><td><p><code>optional</code></p></td><td><p>string | number</p></td><td><p>Sets the width of paper. You can pass in a number or a string with a unit.</p></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-contents table-of-contents__left-border"><li><ahref="#properties"class="table-of-contents__link toc-highlight">Properties</a></li></ul></div></div></div></div></main></div></div></div><footerclass="footer footer--dark"><divclass="container container-fluid"><divclass="row footer__links"><divclass="col footer__col"><divclass="footer__title">Community</div><ulclass="footer__items clean-list"><liclass="footer__item"><ahref="https://stackoverflow.com/questions/tagged/puppeteer"target="_blank"rel="noopener noreferrer"class="footer__link-item">Stack Overflow<svgwidth="13.5"