-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.txt
33 lines (22 loc) · 816 Bytes
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
https://try-puppeteer.appspot.com/
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});
// page.pdf() is currently supported only in headless mode.
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=753118
await page.pdf({
path: 'hn.pdf',
format: 'letter',
displayHeaderFooter: true,
footerTemplate: '<style>body {color: red;}h1{font-size: 12px;}</style><h1>Page <span class="pageNumber"></span> of <span class="totalPages"></span></h1>',
margin: {
top: '100px',
right: '20px',
bottom: '100px',
left: '20px'
},
});
await browser.close();
-----------------
styling header footer:
https://github.com/GoogleChrome/puppeteer/issues/1853