pdfgen 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/VERSION +1 -1
- data/lib/javascript_bin/make_pdf.js +16 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15e1c362c296f17ef5cced91eb85d3771ae1bf7
|
4
|
+
data.tar.gz: b559a21a82d92ca01bfbec59a7847e43a786a38e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1199a39edd356c000e58064ff09cc8473aaf800cccb6daa5e2bd6f39fc1418eee0caed69930b6ac98bb2d2459dd34b5aa75d0b8e6a040da4969852ec50613b
|
7
|
+
data.tar.gz: 700f05c1e96c61fb424f6c43a05aec1456ed6922da8272683c2ab139167e2b94b54f411dd5b95a7ab3e56c19dcff520dbd040725fd061ded4514dcd91531994e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## Pdfgen 0.5.0 (September 3, 2018)
|
2
|
+
|
3
|
+
* Changes how the wait for timeout works slightly.
|
4
|
+
|
5
|
+
This new way starts the wait prior to putting the HTML in the page. Now that we can
|
6
|
+
utilize the waitUntil navigation feature in Puppeteer, we might as well start the
|
7
|
+
clock before waiting for that amount of time. This way, the maximum wait time should
|
8
|
+
be roughly the timeout instead of the timeout + how long the page takes to load.
|
9
|
+
|
10
|
+
* Changes how static HTML is put into the page.
|
11
|
+
|
12
|
+
This new method allows us to use the navigation wait helpers so there should be
|
13
|
+
almost no need for timeout waiting if passing Pdfgen HTML instead of a URL.
|
14
|
+
|
15
|
+
Sadly, this still does not load assets on the page so inlining your assets is still
|
16
|
+
required.
|
17
|
+
|
18
|
+
* Moves emulateMedia and setViewport steps to be before setting content or navigation
|
19
|
+
so that the browser won't need to rerender the content and hopefully we improve
|
20
|
+
performance some.
|
21
|
+
|
1
22
|
## Pdfgen 0.4.2 (June 8, 2018)
|
2
23
|
|
3
24
|
* Adds checking of minimum Node version required.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -41,12 +41,7 @@ stdin.on('end', function () {
|
|
41
41
|
(async() => {
|
42
42
|
const browser = await puppeteer.launch(launch_options);
|
43
43
|
const page = await browser.newPage();
|
44
|
-
|
45
|
-
if (typeof url !== 'undefined' && url) {
|
46
|
-
await page.goto(url, url_options);
|
47
|
-
} else {
|
48
|
-
await page.setContent(html);
|
49
|
-
}
|
44
|
+
let wait_promise = null;
|
50
45
|
|
51
46
|
if (typeof media_type !== 'undefined' && media_type) {
|
52
47
|
await page.emulateMedia(media_type);
|
@@ -57,7 +52,21 @@ stdin.on('end', function () {
|
|
57
52
|
}
|
58
53
|
|
59
54
|
if (typeof wait_for_timeout !== 'undefined' && wait_for_timeout) {
|
60
|
-
|
55
|
+
wait_promise = page.waitFor(wait_for_timeout);
|
56
|
+
}
|
57
|
+
|
58
|
+
if (typeof url !== 'undefined' && url) {
|
59
|
+
await page.goto(url, url_options);
|
60
|
+
} else {
|
61
|
+
await page.goto("data:text/html," + html, { waitUntil: 'networkidle0' });
|
62
|
+
}
|
63
|
+
|
64
|
+
// If we were given a wait timeout, we should wait for the rest of the timeout now. That way,
|
65
|
+
// the timeout will act as a minimum amount of time to wait for the page. If it's greater than
|
66
|
+
// how long the waitUntil idle took, it will wait for the extra time. If it is shorter than how
|
67
|
+
// long the page actually needs, then it will not add any time.
|
68
|
+
if (typeof wait_promise !== 'undefined' && wait_promise) {
|
69
|
+
await wait_promise;
|
61
70
|
}
|
62
71
|
|
63
72
|
if (typeof debug_mode === 'undefined') {
|