-
Notifications
You must be signed in to change notification settings - Fork 1
/
node-async.js
executable file
·39 lines (35 loc) · 1.01 KB
/
node-async.js
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
34
35
36
37
38
39
#!/usr/bin/env node
const krldf = require('..')
const options = {
url: 'https://medium.com/@addyosmani/the-cost-of-javascript-in-2018-7d8950fbb5d4',
filePath: 'addyosmani-the-cost-of-javascript-2018.pdf',
captureDelay: 4000,
viewportWidth: 2560,
viewportHeight: 1440,
paperFormat: 'A4',
landscapeMode: true,
printHeaderTemplate: (`
<div style="font-family:'Nunito Sans','Trebuchet MS',sans-serif;color:#AAA;font-size:6px;text-align:center;width:100%">
<span class="title"></span>
</div>
`),
printFooterTemplate: (`
<div style="font-family:'Nunito Sans','Trebuchet MS',sans-serif;color:#AAA;font-size:6px;text-align:center;width:100%">
Page
<span class="pageNumber"></span>
of
<span class="totalPages"></span>
</div>
`)
}
async function capture(opts) {
try {
const path = await krldf(opts)
console.log('success callback')
process.exit(0)
} catch (err) {
console.log('error callback')
process.exit(1)
}
}
capture(options)