Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e4287e9943 | |||
337c299a5e |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartpdf",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartpdf",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.11",
|
||||
"private": false,
|
||||
"description": "create pdfs on the fly",
|
||||
"main": "dist/index.js",
|
||||
|
1
ts/interfaces/index.ts
Normal file
1
ts/interfaces/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './interface.pdfresult';
|
5
ts/interfaces/interface.pdfresult.ts
Normal file
5
ts/interfaces/interface.pdfresult.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface IPdfResult {
|
||||
name: string,
|
||||
id: string,
|
||||
buffer: Buffer;
|
||||
}
|
@ -5,11 +5,7 @@ import { PdfCandidate } from './smartpdf.classes.pdfcandidate';
|
||||
|
||||
declare const document;
|
||||
|
||||
export interface IPdfResult {
|
||||
name: string,
|
||||
id: string,
|
||||
buffer: Buffer;
|
||||
}
|
||||
import { IPdfResult } from './interfaces';
|
||||
|
||||
export class SmartPdf {
|
||||
htmlServerInstance: Server;
|
||||
@ -80,7 +76,7 @@ export class SmartPdf {
|
||||
id: pdfCandidate.pdfId,
|
||||
name: `${pdfCandidate.pdfId}.js`,
|
||||
buffer: pdfBuffer
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async getPdfForWebsite(websiteUrl: string): Promise<IPdfResult> {
|
||||
@ -99,7 +95,7 @@ export class SmartPdf {
|
||||
id: pdfId,
|
||||
name: `${pdfId}.js`,
|
||||
buffer: pdfBuffer
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async getFullWebsiteAsSinglePdf(websiteUrl: string) {
|
||||
@ -108,7 +104,6 @@ export class SmartPdf {
|
||||
const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' });
|
||||
const pdfId = plugins.smartunique.shortId();
|
||||
const { documentHeight, documentWidth } = await page.evaluate(() => {
|
||||
|
||||
return {
|
||||
documentHeight: document.height,
|
||||
documentWidth: document.width
|
||||
@ -126,6 +121,6 @@ export class SmartPdf {
|
||||
id: pdfId,
|
||||
name: `${pdfId}.js`,
|
||||
buffer: pdfBuffer
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user