@browserless/pdf 13.6.3 → 13.6.4

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.js +12 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/pdf",
3
3
  "description": "Convert websites to high-quality PDFs with customizable margins, background printing, and optimized scaling.",
4
4
  "homepage": "https://browserless.js.org/#/?id=pdfurl-options",
5
- "version": "13.6.3",
5
+ "version": "13.6.4",
6
6
  "main": "src",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -30,8 +30,8 @@
30
30
  "website-to-pdf"
31
31
  ],
32
32
  "dependencies": {
33
- "@browserless/goto": "13.6.3",
34
- "@browserless/screenshot": "13.6.3",
33
+ "@browserless/goto": "13.6.4",
34
+ "@browserless/screenshot": "13.6.4",
35
35
  "@kikobeats/time-span": "~1.0.12",
36
36
  "debug-logfmt": "~1.4.10",
37
37
  "p-reflect": "~2.1.0",
@@ -47,5 +47,5 @@
47
47
  "test": "exit 0"
48
48
  },
49
49
  "license": "MIT",
50
- "gitHead": "7bc1c12120186d999a5ddedbcad4e3b5b52fb8fb"
50
+ "gitHead": "c9d9abe1af82ce0ddf4ce1b6e8fe500c1b58532a"
51
51
  }
package/src/index.js CHANGED
@@ -118,14 +118,24 @@ module.exports = ({ goto, ...gotoOpts } = {}) => {
118
118
  // taller than the viewport — a visibly rendered image (not a tracking
119
119
  // pixel), or enough visible text with webfonts loaded (a pending
120
120
  // `font-display: block` font renders text invisible, exactly when a
121
- // capture would be white) — so it can't be a blank shell: skip the
121
+ // capture would be white) — and that content is not `covered` by an
122
+ // opaque viewport-filling layer (a fixed white loading overlay passes
123
+ // every other DOM signal while a capture stays white): skip the
122
124
  // screenshot poll. Height and viewport come from the same in-page
123
125
  // snapshot (`page.viewport()` is null under `defaultViewport: null`),
124
126
  // and an unknown viewport skips the fast path rather than dropping the
125
127
  // taller-than-viewport guard. A gate that timed out never settled, so
126
128
  // don't trust its partial snapshot: fall through to the blank check.
127
129
  const painted = ready.painted > 0 || (ready.text >= TEXT_PAINTED_MIN && ready.fonts)
128
- if (!ready.timedOut && painted && ready.viewport > 0 && ready.height > ready.viewport) return
130
+ if (
131
+ !ready.timedOut &&
132
+ painted &&
133
+ !ready.covered &&
134
+ ready.viewport > 0 &&
135
+ ready.height > ready.viewport
136
+ ) {
137
+ return
138
+ }
129
139
 
130
140
  // Otherwise fall back to the screenshot poll — re-wait while the first
131
141
  // paint is still blank — to keep the blank-SPA protection. The page has