UNPKG

499 BJavaScriptView Raw
1var PDF = require('./pdf')
2
3module.exports = {
4 create: function createPdf (html, options, callback) {
5 if (arguments.length === 1) {
6 return new PDF(html)
7 }
8
9 if (arguments.length === 2 && typeof options !== 'function') {
10 return new PDF(html, options)
11 }
12
13 if (arguments.length === 2) {
14 callback = options
15 options = {}
16 }
17
18 try {
19 var pdf = new PDF(html, options)
20 } catch (err) {
21 return callback(err)
22 }
23
24 pdf.exec(callback)
25 }
26}