puppeteer/assets/js/e629e34a.71319ebc.js

2 lines
9.2 KiB
JavaScript
Raw Normal View History

/*! For license information please see e629e34a.71319ebc.js.LICENSE.txt */
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[42822],{87249:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>a,frontMatter:()=>i,metadata:()=>c,toc:()=>o});var r=n(85893),d=n(11151);const i={sidebar_label:"PDFOptions"},s="PDFOptions interface",c={id:"api/puppeteer.pdfoptions",title:"PDFOptions interface",description:"Valid options to configure PDF generation via Page.pdf().",source:"@site/../docs/api/puppeteer.pdfoptions.md",sourceDirName:"api",slug:"/api/puppeteer.pdfoptions",permalink:"/next/api/puppeteer.pdfoptions",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{sidebar_label:"PDFOptions"},sidebar:"api",previous:{title:"PDFMargin",permalink:"/next/api/puppeteer.pdfmargin"},next:{title:"Permission",permalink:"/next/api/puppeteer.permission"}},l={},o=[{value:"Signature:",id:"signature",level:4},{value:"Properties",id:"properties",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,d.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{id:"pdfoptions-interface",children:"PDFOptions interface"}),"\n",(0,r.jsxs)(t.p,{children:["Valid options to configure PDF generation via ",(0,r.jsx)(t.a,{href:"/next/api/puppeteer.page.pdf",children:"Page.pdf()"}),"."]}),"\n",(0,r.jsx)(t.h4,{id:"signature",children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"export interface PDFOptions\n"})}),"\n",(0,r.jsx)(t.h2,{id:"properties",children:"Properties"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Property"}),(0,r.jsx)(t.th,{children:"Modifiers"}),(0,r.jsx)(t.th,{children:"Type"}),(0,r.jsx)(t.th,{children:"Description"}),(0,r.jsx)(t.th,{children:"Default"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"displayHeaderFooter"}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"optional"})}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:"Whether to show the header and footer."}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"false"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"footerTemplate"}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"optional"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsxs)(t.td,{children:["HTML template for the print footer. Has the same constraints and support for special classes as ",(0,r.jsx)(t.a,{href:"/next/api/puppeteer.pdfoptions",children:"PDFOptions.headerTemplate"}),"."]}),(0,r.jsx)(t.td,{})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"format"}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"optional"})}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.a,{href:"/next/api/puppeteer.paperformat",children:"PaperFormat"})}),(0,r.jsx)(t.td,{}),(0,r.jsxs)(t.td,{children:[(0,r.jsx)("code",{children:"letter"}),"."]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"headerTemplate"}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"optional"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsxs)(t.td,{children:[(0,r.jsx)("p",{children:"HTML template for the print header. Should be valid HTML with the following classes used to inject values into them:"}),(0,r.jsxs)("p",{children:["- ",(0,r.jsx)("code",{children:"date"})," formatted print date"]}),(0,r.jsxs)("p",{children:["- ",(0,r.jsx)("code",{children:"title"})," document title"]}),(0,r.jsxs)("p",{children:["- ",(0,r.jsx)("code",{children:"url"})," document location"]}),(0,r.jsxs)("p",{children:["- ",(0,r.jsx)("code",{children:"pageNumber"})," current page number"]}),(0,r.jsxs)("p",{children:["- ",(0,r.jsx)("code",{children:"totalPages"})," total pages in the document"]})]}),(0,r.jsx)(t.td,{})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"height"}),(0,r.jsx)(t.td,{children:(0,r.jsx)("code",{children:"optional"})}),(0,r.jsx)(t.td,{children:"string | number"}),(0,r.jsx)(t.td,{children:"Sets the height of paper. You can pass in a numb