fix(core): update
This commit is contained in:
@@ -3,7 +3,7 @@ import * as paths from './smartpdf.paths';
|
||||
import { Server } from 'http';
|
||||
import { PdfCandidate } from './smartpdf.classes.pdfcandidate';
|
||||
|
||||
declare const document;
|
||||
declare const document: any;
|
||||
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
@@ -19,7 +19,7 @@ export class SmartPdf {
|
||||
this._readyDeferred = new plugins.smartpromise.Deferred();
|
||||
}
|
||||
|
||||
async start(headlessBrowserArg?) {
|
||||
async start(headlessBrowserArg?: plugins.smartpuppeteer.puppeteer.Browser) {
|
||||
// lets set the external browser in case one is provided
|
||||
this.headlessBrowser = headlessBrowserArg;
|
||||
// setup puppeteer
|
||||
@@ -80,7 +80,7 @@ export class SmartPdf {
|
||||
}
|
||||
|
||||
const pdfBuffer = await page.pdf({
|
||||
format: 'A4',
|
||||
format: 'a4',
|
||||
printBackground: true,
|
||||
displayHeaderFooter: false,
|
||||
preferCSSPageSize: true,
|
||||
@@ -108,7 +108,7 @@ export class SmartPdf {
|
||||
};
|
||||
});
|
||||
const pdfBuffer = await page.pdf({
|
||||
format: 'A4',
|
||||
format: 'a4',
|
||||
height: documentWidth,
|
||||
width: documentWidth,
|
||||
printBackground: true,
|
||||
@@ -135,7 +135,7 @@ export class SmartPdf {
|
||||
};
|
||||
});
|
||||
const pdfBuffer = await page.pdf({
|
||||
format: 'A4',
|
||||
format: 'a4',
|
||||
height: documentWidth,
|
||||
width: documentWidth,
|
||||
printBackground: true,
|
||||
@@ -149,4 +149,12 @@ export class SmartPdf {
|
||||
buffer: pdfBuffer,
|
||||
};
|
||||
}
|
||||
|
||||
public async mergePdfBuffers(pdfBuffers: Buffer[]): Promise<Buffer> {
|
||||
const merger = new plugins.pdfMerger();
|
||||
for (const buffer of pdfBuffers) {
|
||||
merger.add(buffer);
|
||||
}
|
||||
return merger.saveAsBuffer();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user