Compare commits

..

2 Commits

Author SHA1 Message Date
e4287e9943 1.0.11 2019-06-03 10:51:16 +02:00
337c299a5e fix(core): update 2019-06-03 10:51:15 +02:00
5 changed files with 13 additions and 12 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpdf", "name": "@pushrocks/smartpdf",
"version": "1.0.10", "version": "1.0.11",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpdf", "name": "@pushrocks/smartpdf",
"version": "1.0.10", "version": "1.0.11",
"private": false, "private": false,
"description": "create pdfs on the fly", "description": "create pdfs on the fly",
"main": "dist/index.js", "main": "dist/index.js",

1
ts/interfaces/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './interface.pdfresult';

View File

@ -0,0 +1,5 @@
export interface IPdfResult {
name: string,
id: string,
buffer: Buffer;
}

View File

@ -5,11 +5,7 @@ import { PdfCandidate } from './smartpdf.classes.pdfcandidate';
declare const document; declare const document;
export interface IPdfResult { import { IPdfResult } from './interfaces';
name: string,
id: string,
buffer: Buffer;
}
export class SmartPdf { export class SmartPdf {
htmlServerInstance: Server; htmlServerInstance: Server;
@ -80,7 +76,7 @@ export class SmartPdf {
id: pdfCandidate.pdfId, id: pdfCandidate.pdfId,
name: `${pdfCandidate.pdfId}.js`, name: `${pdfCandidate.pdfId}.js`,
buffer: pdfBuffer buffer: pdfBuffer
} };
} }
async getPdfForWebsite(websiteUrl: string): Promise<IPdfResult> { async getPdfForWebsite(websiteUrl: string): Promise<IPdfResult> {
@ -99,7 +95,7 @@ export class SmartPdf {
id: pdfId, id: pdfId,
name: `${pdfId}.js`, name: `${pdfId}.js`,
buffer: pdfBuffer buffer: pdfBuffer
} };
} }
async getFullWebsiteAsSinglePdf(websiteUrl: string) { async getFullWebsiteAsSinglePdf(websiteUrl: string) {
@ -107,8 +103,7 @@ export class SmartPdf {
page.emulateMedia('screen'); page.emulateMedia('screen');
const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' }); const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' });
const pdfId = plugins.smartunique.shortId(); const pdfId = plugins.smartunique.shortId();
const {documentHeight, documentWidth} = await page.evaluate(() => { const { documentHeight, documentWidth } = await page.evaluate(() => {
return { return {
documentHeight: document.height, documentHeight: document.height,
documentWidth: document.width documentWidth: document.width
@ -126,6 +121,6 @@ export class SmartPdf {
id: pdfId, id: pdfId,
name: `${pdfId}.js`, name: `${pdfId}.js`,
buffer: pdfBuffer buffer: pdfBuffer
} };
} }
} }