-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): migrate page.pdf() docs (#6228)
Also took the opportunity to pull out the PDF types into their own file to clear up `Page.ts` slightly and give the PDF code a more natural place to live.
- Loading branch information
1 parent
2331584
commit 9fdf2ba
Showing
29 changed files
with
587 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PaperFormat](./puppeteer.paperformat.md) | ||
|
||
## PaperFormat type | ||
|
||
All the valid paper format types when printing a PDF. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type PaperFormat = 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6'; | ||
``` | ||
|
||
## Remarks | ||
|
||
The sizes of each format are as follows: - `Letter`<!-- -->: 8.5in x 11in | ||
|
||
- `Legal`<!-- -->: 8.5in x 14in | ||
|
||
- `Tabloid`<!-- -->: 11in x 17in | ||
|
||
- `Ledger`<!-- -->: 17in x 11in | ||
|
||
- `A0`<!-- -->: 33.1in x 46.8in | ||
|
||
- `A1`<!-- -->: 23.4in x 33.1in | ||
|
||
- `A2`<!-- -->: 16.54in x 23.4in | ||
|
||
- `A3`<!-- -->: 11.7in x 16.54in | ||
|
||
- `A4`<!-- -->: 8.27in x 11.7in | ||
|
||
- `A5`<!-- -->: 5.83in x 8.27in | ||
|
||
- `A6`<!-- -->: 4.13in x 5.83in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFMargin](./puppeteer.pdfmargin.md) > [bottom](./puppeteer.pdfmargin.bottom.md) | ||
|
||
## PDFMargin.bottom property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
bottom?: string | number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFMargin](./puppeteer.pdfmargin.md) > [left](./puppeteer.pdfmargin.left.md) | ||
|
||
## PDFMargin.left property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
left?: string | number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFMargin](./puppeteer.pdfmargin.md) | ||
|
||
## PDFMargin interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface PDFMargin | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [bottom](./puppeteer.pdfmargin.bottom.md) | string \| number | | | ||
| [left](./puppeteer.pdfmargin.left.md) | string \| number | | | ||
| [right](./puppeteer.pdfmargin.right.md) | string \| number | | | ||
| [top](./puppeteer.pdfmargin.top.md) | string \| number | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFMargin](./puppeteer.pdfmargin.md) > [right](./puppeteer.pdfmargin.right.md) | ||
|
||
## PDFMargin.right property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
right?: string | number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFMargin](./puppeteer.pdfmargin.md) > [top](./puppeteer.pdfmargin.top.md) | ||
|
||
## PDFMargin.top property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
top?: string | number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [displayHeaderFooter](./puppeteer.pdfoptions.displayheaderfooter.md) | ||
|
||
## PDFOptions.displayHeaderFooter property | ||
|
||
Whether to show the header and footer. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
displayHeaderFooter?: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [footerTemplate](./puppeteer.pdfoptions.footertemplate.md) | ||
|
||
## PDFOptions.footerTemplate property | ||
|
||
HTML template for the print footer. Has the same constraints and support for special classes as [PDFOptions.headerTemplate](./puppeteer.pdfoptions.headertemplate.md)<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
footerTemplate?: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [format](./puppeteer.pdfoptions.format.md) | ||
|
||
## PDFOptions.format property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
format?: PaperFormat; | ||
``` | ||
|
||
## Remarks | ||
|
||
If set, this takes priority over the `width` and `height` options. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [headerTemplate](./puppeteer.pdfoptions.headertemplate.md) | ||
|
||
## PDFOptions.headerTemplate property | ||
|
||
HTML template for the print header. Should be valid HTML with the following classes used to inject values into them: - `date` formatted print date | ||
|
||
- `title` document title | ||
|
||
- `url` document location | ||
|
||
- `pageNumber` current page number | ||
|
||
- `totalPages` total pages in the document | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
headerTemplate?: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [height](./puppeteer.pdfoptions.height.md) | ||
|
||
## PDFOptions.height property | ||
|
||
Sets the height of paper. You can pass in a number or a string with a unit. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
height?: string | number; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [landscape](./puppeteer.pdfoptions.landscape.md) | ||
|
||
## PDFOptions.landscape property | ||
|
||
Whether to print in landscape orientation. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
landscape?: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [margin](./puppeteer.pdfoptions.margin.md) | ||
|
||
## PDFOptions.margin property | ||
|
||
Set the PDF margins. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
margin?: PDFMargin; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) | ||
|
||
## PDFOptions interface | ||
|
||
Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md)<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface PDFOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [displayHeaderFooter](./puppeteer.pdfoptions.displayheaderfooter.md) | boolean | Whether to show the header and footer. | | ||
| [footerTemplate](./puppeteer.pdfoptions.footertemplate.md) | string | HTML template for the print footer. Has the same constraints and support for special classes as [PDFOptions.headerTemplate](./puppeteer.pdfoptions.headertemplate.md)<!-- -->. | | ||
| [format](./puppeteer.pdfoptions.format.md) | [PaperFormat](./puppeteer.paperformat.md) | | | ||
| [headerTemplate](./puppeteer.pdfoptions.headertemplate.md) | string | HTML template for the print header. Should be valid HTML with the following classes used to inject values into them: - <code>date</code> formatted print date<!-- -->- <code>title</code> document title<!-- -->- <code>url</code> document location<!-- -->- <code>pageNumber</code> current page number<!-- -->- <code>totalPages</code> total pages in the document | | ||
| [height](./puppeteer.pdfoptions.height.md) | string \| number | Sets the height of paper. You can pass in a number or a string with a unit. | | ||
| [landscape](./puppeteer.pdfoptions.landscape.md) | boolean | Whether to print in landscape orientation. | | ||
| [margin](./puppeteer.pdfoptions.margin.md) | [PDFMargin](./puppeteer.pdfmargin.md) | Set the PDF margins. | | ||
| [pageRanges](./puppeteer.pdfoptions.pageranges.md) | string | Paper ranges to print, e.g. <code>1-5, 8, 11-13</code>. | | ||
| [path](./puppeteer.pdfoptions.path.md) | string | The path to save the file to. | | ||
| [preferCSSPageSize](./puppeteer.pdfoptions.prefercsspagesize.md) | boolean | 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. | | ||
| [printBackground](./puppeteer.pdfoptions.printbackground.md) | boolean | Set to <code>true</code> to print background graphics. | | ||
| [scale](./puppeteer.pdfoptions.scale.md) | number | Scales the rendering of the web page. Amount must be between <code>0.1</code> and <code>2</code>. | | ||
| [width](./puppeteer.pdfoptions.width.md) | string \| number | Sets the width of paper. You can pass in a number or a string with a unit. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [pageRanges](./puppeteer.pdfoptions.pageranges.md) | ||
|
||
## PDFOptions.pageRanges property | ||
|
||
Paper ranges to print, e.g. `1-5, 8, 11-13`<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
pageRanges?: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [path](./puppeteer.pdfoptions.path.md) | ||
|
||
## PDFOptions.path property | ||
|
||
The path to save the file to. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
path?: string; | ||
``` | ||
|
||
## Remarks | ||
|
||
If the path is relative, it's resolved relative to the current working directory. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [PDFOptions](./puppeteer.pdfoptions.md) > [preferCSSPageSize](./puppeteer.pdfoptions.prefercsspagesize.md) | ||
|
||
## PDFOptions.preferCSSPageSize property | ||
|
||
Give any CSS `@page` size declared in the page priority over what is declared in the `width` or `height` or `format` option. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
preferCSSPageSize?: boolean; | ||
``` |
Oops, something went wrong.