Compare commits

...

12 Commits

Author SHA1 Message Date
b0e388c50d 1.0.27 2019-11-15 19:59:57 +01:00
f37c9d8375 fix(core): update 2019-11-15 19:59:57 +01:00
18c8ef9606 1.0.26 2019-11-12 15:45:26 +01:00
6766a3d0dc fix(core): update 2019-11-12 15:45:26 +01:00
d16f447048 1.0.25 2019-11-12 15:41:58 +01:00
37c752c2ae fix(core): update 2019-11-12 15:41:58 +01:00
b088d26e6f 1.0.24 2019-11-12 14:41:04 +01:00
425f11a334 fix(core): update 2019-11-12 14:41:03 +01:00
5ddbea1a5a 1.0.23 2019-11-11 13:04:36 +01:00
42c5121784 fix(core): update 2019-11-11 13:04:36 +01:00
d960d85539 1.0.22 2019-11-11 13:04:13 +01:00
ca60217a18 fix(core): update 2019-11-11 13:04:13 +01:00
5 changed files with 1013 additions and 702 deletions

View File

@ -4,13 +4,13 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
# ==================== # ====================
# security stage # security stage
@ -20,6 +20,7 @@ mirror:
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -31,6 +32,7 @@ snyk:
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command snyk test
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -38,38 +40,41 @@ snyk:
# test stage # test stage
# ==================== # ====================
testLTS: testStable:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv - priv
testBuild: testBuild:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
- npmci node install lts - npmci node install stable
- npmci npm install - npmci npm install
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install lts - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
@ -81,9 +86,11 @@ codequality:
allow_failure: true allow_failure: true
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags: tags:
- lossless
- docker - docker
- priv - priv
@ -94,20 +101,20 @@ trigger:
only: only:
- tags - tags
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
stage: metadata stage: metadata
script: script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command tsdoc - npmci command tsdoc
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:

1571
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpdf", "name": "@pushrocks/smartpdf",
"version": "1.0.21", "version": "1.0.27",
"private": false, "private": false,
"description": "create pdfs on the fly", "description": "create pdfs on the fly",
"main": "dist/index.js", "main": "dist/index.js",
@ -13,28 +13,30 @@
"build": "(tsbuild)" "build": "(tsbuild)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.11", "@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.0.11", "@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.1" "@types/node": "^12.12.7",
"tslint": "^6.0.0-beta0",
"tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^7.0.4", "@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartnetwork": "^1.1.6", "@pushrocks/smartnetwork": "^1.1.14",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartpuppeteer": "^1.0.5", "@pushrocks/smartpuppeteer": "^1.0.6",
"@pushrocks/smartunique": "^3.0.1", "@pushrocks/smartunique": "^3.0.1",
"@types/express": "^4.17.0", "@types/express": "^4.17.2",
"express": "^4.17.1" "express": "^4.17.1"
}, },
"files": [ "files": [
"ts/*", "ts/**/*",
"ts_web/*", "ts_web/**/*",
"dist/*", "dist/**/*",
"dist_web/*", "dist_web/**/*",
"dist_ts_web/*", "dist_ts_web/**/*",
"assets/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"

View File

@ -18,6 +18,11 @@ Create PDFs fast and smoothly
## Usage ## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)

View File

@ -26,7 +26,9 @@ export class SmartPdf {
if (this.headlessBrowser) { if (this.headlessBrowser) {
this.externalBrowserBool = true; this.externalBrowserBool = true;
} else { } else {
this.headlessBrowser = await plugins.smartpuppeteer.getEnvAwareBrowserInstance(); this.headlessBrowser = await plugins.smartpuppeteer.getEnvAwareBrowserInstance({
forceNoSandbox: true
});
} }
// setup server // setup server
@ -78,7 +80,10 @@ export class SmartPdf {
} }
const pdfBuffer = await page.pdf({ const pdfBuffer = await page.pdf({
format: 'A4' format: 'A4',
printBackground: true,
displayHeaderFooter: false,
preferCSSPageSize: true
}); });
await page.close(); await page.close();
delete this._candidates[pdfCandidate.pdfId]; delete this._candidates[pdfCandidate.pdfId];
@ -96,8 +101,16 @@ 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(() => {
return {
documentHeight: document.height,
documentWidth: document.width
};
});
const pdfBuffer = await page.pdf({ const pdfBuffer = await page.pdf({
format: 'A4', format: 'A4',
height: documentWidth,
width: documentWidth,
printBackground: true, printBackground: true,
displayHeaderFooter: false, displayHeaderFooter: false,
preferCSSPageSize: true preferCSSPageSize: true
@ -122,6 +135,7 @@ export class SmartPdf {
}; };
}); });
const pdfBuffer = await page.pdf({ const pdfBuffer = await page.pdf({
format: 'A4',
height: documentWidth, height: documentWidth,
width: documentWidth, width: documentWidth,
printBackground: true, printBackground: true,