diff --git a/assets/pdfdir/ERpClkJ4T.pdf b/assets/pdfdir/ERpClkJ4T.pdf new file mode 100644 index 0000000..5db1b9e Binary files /dev/null and b/assets/pdfdir/ERpClkJ4T.pdf differ diff --git a/assets/pdfdir/deSPavVfr.pdf b/assets/pdfdir/deSPavVfr.pdf new file mode 100644 index 0000000..60086a2 Binary files /dev/null and b/assets/pdfdir/deSPavVfr.pdf differ diff --git a/assets/pdfdir/yR7XuEXeT.pdf b/assets/pdfdir/yR7XuEXeT.pdf new file mode 100644 index 0000000..78d9e05 Binary files /dev/null and b/assets/pdfdir/yR7XuEXeT.pdf differ diff --git a/test/test.ts b/test/test.ts index 4911d16..132de2f 100644 --- a/test/test.ts +++ b/test/test.ts @@ -8,6 +8,10 @@ tap.test('should create a valid instance of smartpdf', async () => { expect(testSmartPdf).to.be.instanceof(smartpdf.SmartPdf); }); +tap.test('should start the instance', async () => { + await testSmartPdf.start(); +}); + tap.test('should create a pdf from html string', async () => { await testSmartPdf.getPdfForHtmlString('hi'); }); @@ -21,7 +25,7 @@ tap.test('should create a pdf from website as single page PDF', async () => { }); tap.test('should be able to close properly', async () => { - await testSmartPdf.close(); + await testSmartPdf.stop(); }); tap.start(); diff --git a/ts/smartpdf.classes.smartpdf.ts b/ts/smartpdf.classes.smartpdf.ts index 37a701c..d09eff2 100644 --- a/ts/smartpdf.classes.smartpdf.ts +++ b/ts/smartpdf.classes.smartpdf.ts @@ -14,10 +14,9 @@ export class SmartPdf { constructor() { this._readyDeferred = new plugins.smartpromise.Deferred(); - this.init(); } - async init() { + async start() { // setup puppeteer this.headlessBrowser = await plugins.puppeteer.launch(); @@ -36,7 +35,7 @@ export class SmartPdf { }); } - async close() { + async stop() { const done = plugins.smartpromise.defer(); this.htmlServerInstance.close(() => { done.resolve();