puppeteer/assets/js/d5d2de27.b042a2f5.js

2 lines
9.5 KiB
JavaScript
Raw Normal View History

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