genus-pdf-viewer 0.1.9 → 0.1.11
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.
- package/README.md +15 -0
- package/fesm2022/genus-pdf-viewer.mjs +325 -140
- package/fesm2022/genus-pdf-viewer.mjs.map +1 -1
- package/index.d.ts +15 -2
- package/package.json +5 -1
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +168 -0
- package/schematics/ng-add/schema.json +27 -0
package/README.md
CHANGED
|
@@ -10,6 +10,21 @@ npm i pdfjs-dist
|
|
|
10
10
|
|
|
11
11
|
This library declares `pdfjs-dist` as a dependency and Angular as peer dependencies.
|
|
12
12
|
|
|
13
|
+
## Quick setup with ng add
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng add genus-pdf-viewer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ng add` will:
|
|
20
|
+
- add `provideGenusPdfViewer()` to your app config when `app.config.ts` is found
|
|
21
|
+
- copy `pdf.worker.min.mjs` to your app assets/public path
|
|
22
|
+
|
|
23
|
+
Optional flags:
|
|
24
|
+
- `--project <name>` target a specific Angular app in a workspace
|
|
25
|
+
- `--skipWorkerCopy` skip worker file copy
|
|
26
|
+
- `--overwriteWorker` replace existing worker file
|
|
27
|
+
|
|
13
28
|
## Worker setup (recommended: library provider)
|
|
14
29
|
|
|
15
30
|
Use the provider shipped by the library, which sets a sensible default and allows overrides.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, effect, ViewChild, Input, Component, InjectionToken,
|
|
2
|
+
import { signal, effect, ViewChild, Input, Component, InjectionToken, PLATFORM_ID, APP_INITIALIZER } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import * as pdfjsLib from 'pdfjs-dist';
|
|
@@ -17,6 +17,9 @@ class GenusPdfViewerComponent {
|
|
|
17
17
|
zoomAnimation = true;
|
|
18
18
|
zoomAnimationMs = 180;
|
|
19
19
|
gestureAnimationMs = 120;
|
|
20
|
+
loadTimeoutMs = 45000;
|
|
21
|
+
withCredentials = false;
|
|
22
|
+
httpHeaders;
|
|
20
23
|
canvas;
|
|
21
24
|
singleStage;
|
|
22
25
|
stage;
|
|
@@ -44,6 +47,7 @@ class GenusPdfViewerComponent {
|
|
|
44
47
|
WHEEL_STEP = 0.02;
|
|
45
48
|
PINCH_SENSITIVITY = 0.5;
|
|
46
49
|
wheelCommitTimer = 0;
|
|
50
|
+
lastLoadError = null;
|
|
47
51
|
constructor() {
|
|
48
52
|
effect(() => {
|
|
49
53
|
// Only react to zoom changes here; page changes in continuous mode should NOT trigger a re-render
|
|
@@ -98,39 +102,211 @@ class GenusPdfViewerComponent {
|
|
|
98
102
|
async loadDocument() {
|
|
99
103
|
this.loading.set(true);
|
|
100
104
|
this.error.set(null);
|
|
105
|
+
this.lastLoadError = null;
|
|
106
|
+
if (this.doc) {
|
|
107
|
+
try {
|
|
108
|
+
await this.doc.destroy();
|
|
109
|
+
}
|
|
110
|
+
catch { }
|
|
111
|
+
this.doc = undefined;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
this.doc = await this.loadDocumentWithFallbacks(this.src);
|
|
115
|
+
if (!this.doc)
|
|
116
|
+
this.error.set(this.buildLoadErrorMessage());
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
this.doc = undefined;
|
|
120
|
+
this.error.set(this.buildLoadErrorMessage());
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
this.loading.set(false);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async loadDocumentWithFallbacks(src) {
|
|
127
|
+
const workerCandidates = this.getWorkerSrcCandidates();
|
|
128
|
+
const baseTimeout = this.getEffectiveLoadTimeoutMs();
|
|
129
|
+
const primary = this.createPrimaryParams(src);
|
|
130
|
+
if (primary && workerCandidates.length) {
|
|
131
|
+
for (let i = 0; i < workerCandidates.length; i++) {
|
|
132
|
+
this.applyWorkerSrc(workerCandidates[i]);
|
|
133
|
+
const timeoutMs = i === 0 ? baseTimeout : Math.min(baseTimeout, 12000);
|
|
134
|
+
const doc = await this.tryLoadDocument(primary, timeoutMs);
|
|
135
|
+
if (doc)
|
|
136
|
+
return doc;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (primary) {
|
|
140
|
+
const doc = await this.tryLoadDocument(primary, baseTimeout);
|
|
141
|
+
if (doc)
|
|
142
|
+
return doc;
|
|
143
|
+
}
|
|
144
|
+
const bytes = await this.toPdfBytes(src);
|
|
145
|
+
if (!bytes)
|
|
146
|
+
return undefined;
|
|
147
|
+
const byteParams = {
|
|
148
|
+
data: bytes,
|
|
149
|
+
disableRange: true,
|
|
150
|
+
disableStream: true,
|
|
151
|
+
disableAutoFetch: true,
|
|
152
|
+
stopAtErrors: true,
|
|
153
|
+
};
|
|
154
|
+
if (workerCandidates.length) {
|
|
155
|
+
for (let i = 0; i < workerCandidates.length; i++) {
|
|
156
|
+
this.applyWorkerSrc(workerCandidates[i]);
|
|
157
|
+
const timeoutMs = i === 0 ? baseTimeout : Math.min(baseTimeout, 12000);
|
|
158
|
+
const doc = await this.tryLoadDocument(byteParams, timeoutMs);
|
|
159
|
+
if (doc)
|
|
160
|
+
return doc;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
return this.tryLoadDocument(byteParams, baseTimeout);
|
|
165
|
+
}
|
|
166
|
+
createPrimaryParams(src) {
|
|
167
|
+
if (typeof src === 'string') {
|
|
168
|
+
return {
|
|
169
|
+
url: src,
|
|
170
|
+
withCredentials: this.withCredentials,
|
|
171
|
+
httpHeaders: this.httpHeaders,
|
|
172
|
+
stopAtErrors: true,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (src instanceof URL) {
|
|
176
|
+
return {
|
|
177
|
+
url: src.toString(),
|
|
178
|
+
withCredentials: this.withCredentials,
|
|
179
|
+
httpHeaders: this.httpHeaders,
|
|
180
|
+
stopAtErrors: true,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (src instanceof Uint8Array) {
|
|
184
|
+
const copy = new Uint8Array(src.byteLength);
|
|
185
|
+
copy.set(src);
|
|
186
|
+
return {
|
|
187
|
+
data: copy,
|
|
188
|
+
disableRange: true,
|
|
189
|
+
disableStream: true,
|
|
190
|
+
disableAutoFetch: true,
|
|
191
|
+
stopAtErrors: true,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
async tryLoadDocument(params, timeoutMs) {
|
|
197
|
+
const task = pdfjsLib.getDocument(params);
|
|
198
|
+
let timer = null;
|
|
101
199
|
try {
|
|
102
|
-
|
|
103
|
-
|
|
200
|
+
if (timeoutMs <= 0) {
|
|
201
|
+
return await task.promise;
|
|
202
|
+
}
|
|
203
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
204
|
+
timer = setTimeout(() => reject(new Error('PDF load timeout')), timeoutMs);
|
|
205
|
+
});
|
|
206
|
+
return await Promise.race([task.promise, timeoutPromise]);
|
|
104
207
|
}
|
|
105
208
|
catch (e) {
|
|
106
|
-
|
|
107
|
-
// Try fetching the whole file via fetch() and pass ArrayBuffer to pdf.js.
|
|
209
|
+
this.lastLoadError = e;
|
|
108
210
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
211
|
+
await task.destroy();
|
|
212
|
+
}
|
|
213
|
+
catch { }
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
finally {
|
|
217
|
+
if (timer)
|
|
218
|
+
clearTimeout(timer);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
getEffectiveLoadTimeoutMs() {
|
|
222
|
+
if (!Number.isFinite(this.loadTimeoutMs))
|
|
223
|
+
return 45000;
|
|
224
|
+
if (this.loadTimeoutMs <= 0)
|
|
225
|
+
return 0;
|
|
226
|
+
return Math.max(5000, this.loadTimeoutMs);
|
|
227
|
+
}
|
|
228
|
+
resolveBundledWorkerSrc() {
|
|
229
|
+
try {
|
|
230
|
+
return new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
getWorkerSrcCandidates() {
|
|
237
|
+
const options = pdfjsLib.GlobalWorkerOptions || {};
|
|
238
|
+
const current = typeof options.workerSrc === 'string' ? options.workerSrc : '';
|
|
239
|
+
const bundled = this.resolveBundledWorkerSrc() || '';
|
|
240
|
+
const asset = '/assets/pdf.worker.min.mjs';
|
|
241
|
+
const candidates = [bundled, current, asset].filter((v) => !!v);
|
|
242
|
+
return Array.from(new Set(candidates));
|
|
243
|
+
}
|
|
244
|
+
applyWorkerSrc(workerSrc) {
|
|
245
|
+
const options = pdfjsLib.GlobalWorkerOptions || {};
|
|
246
|
+
options.workerPort = null;
|
|
247
|
+
options.workerSrc = workerSrc;
|
|
248
|
+
}
|
|
249
|
+
buildLoadErrorMessage() {
|
|
250
|
+
const raw = this.extractErrorText(this.lastLoadError).trim();
|
|
251
|
+
const lower = raw.toLowerCase();
|
|
252
|
+
if (lower.includes('worker')) {
|
|
253
|
+
return 'PDF worker failed to load. Run ng add genus-pdf-viewer (or copy pdf.worker.min.mjs to /assets) and retry.';
|
|
254
|
+
}
|
|
255
|
+
if (lower.includes('cors') || lower.includes('network') || lower.includes('fetch')) {
|
|
256
|
+
return 'PDF request failed. Check file URL, network, and CORS policy, then retry.';
|
|
257
|
+
}
|
|
258
|
+
if (lower.includes('password')) {
|
|
259
|
+
return 'This PDF appears to be password protected.';
|
|
260
|
+
}
|
|
261
|
+
return 'Failed to load PDF. Check URL/CORS and worker setup, then retry.';
|
|
262
|
+
}
|
|
263
|
+
extractErrorText(error) {
|
|
264
|
+
if (!error)
|
|
265
|
+
return '';
|
|
266
|
+
if (typeof error === 'string')
|
|
267
|
+
return error;
|
|
268
|
+
if (typeof error === 'object') {
|
|
269
|
+
const maybeMessage = error.message;
|
|
270
|
+
if (typeof maybeMessage === 'string')
|
|
271
|
+
return maybeMessage;
|
|
272
|
+
try {
|
|
273
|
+
return JSON.stringify(error);
|
|
125
274
|
}
|
|
126
275
|
catch {
|
|
127
|
-
|
|
276
|
+
return String(error);
|
|
128
277
|
}
|
|
129
|
-
if (!this.doc)
|
|
130
|
-
this.error.set('Failed to load PDF');
|
|
131
278
|
}
|
|
132
|
-
|
|
133
|
-
|
|
279
|
+
return String(error);
|
|
280
|
+
}
|
|
281
|
+
async toPdfBytes(src) {
|
|
282
|
+
if (src instanceof Uint8Array) {
|
|
283
|
+
const copy = new Uint8Array(src.byteLength);
|
|
284
|
+
copy.set(src);
|
|
285
|
+
return copy;
|
|
286
|
+
}
|
|
287
|
+
if (src instanceof Blob) {
|
|
288
|
+
try {
|
|
289
|
+
return new Uint8Array(await src.arrayBuffer());
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const href = typeof src === 'string' ? src : src.toString();
|
|
296
|
+
if (typeof fetch === 'undefined')
|
|
297
|
+
return null;
|
|
298
|
+
try {
|
|
299
|
+
const res = await fetch(href, {
|
|
300
|
+
mode: 'cors',
|
|
301
|
+
headers: this.httpHeaders,
|
|
302
|
+
credentials: this.withCredentials ? 'include' : 'same-origin',
|
|
303
|
+
});
|
|
304
|
+
if (!res.ok)
|
|
305
|
+
return null;
|
|
306
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return null;
|
|
134
310
|
}
|
|
135
311
|
}
|
|
136
312
|
async render() {
|
|
@@ -194,96 +370,100 @@ class GenusPdfViewerComponent {
|
|
|
194
370
|
const existing = Array.from(stageEl.querySelectorAll('.pdf-page'));
|
|
195
371
|
const isInitialBuild = existing.length !== total;
|
|
196
372
|
this.renderLockCount++;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
stageEl.appendChild(contentEl);
|
|
202
|
-
for (let i = 1; i <= total; i++) {
|
|
203
|
-
const page = await this.doc.getPage(i);
|
|
204
|
-
const baseViewport = page.getViewport({ scale: 1 });
|
|
205
|
-
let baseScale = 1;
|
|
206
|
-
if (this.fit === 'width')
|
|
207
|
-
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
208
|
-
if (this.fit === 'page')
|
|
209
|
-
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
210
|
-
const minScale = baseScale * this.minZoom;
|
|
211
|
-
const maxScale = baseScale * this.maxZoom;
|
|
212
|
-
const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));
|
|
213
|
-
if (i === 1)
|
|
214
|
-
computedCanPan = finalScale > baseScale + 0.001;
|
|
215
|
-
const viewport = page.getViewport({ scale: finalScale });
|
|
216
|
-
const wrapper = document.createElement('div');
|
|
217
|
-
wrapper.className = 'pdf-page';
|
|
218
|
-
wrapper.setAttribute('data-page', String(i));
|
|
219
|
-
wrapper.style.width = Math.floor(viewport.width) + 'px';
|
|
220
|
-
wrapper.style.height = Math.floor(viewport.height) + 'px';
|
|
221
|
-
wrapper.style.margin = '0 auto 12px auto';
|
|
222
|
-
const canvas = document.createElement('canvas');
|
|
223
|
-
const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;
|
|
224
|
-
canvas.style.width = Math.floor(viewport.width) + 'px';
|
|
225
|
-
canvas.style.height = Math.floor(viewport.height) + 'px';
|
|
226
|
-
canvas.width = Math.floor(viewport.width * dpr);
|
|
227
|
-
canvas.height = Math.floor(viewport.height * dpr);
|
|
228
|
-
const ctx = canvas.getContext('2d');
|
|
229
|
-
wrapper.appendChild(canvas);
|
|
230
|
-
contentEl.appendChild(wrapper);
|
|
231
|
-
const renderCtx = { canvasContext: ctx, viewport };
|
|
232
|
-
if (dpr !== 1)
|
|
233
|
-
renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];
|
|
234
|
-
const task = page.render(renderCtx);
|
|
235
|
-
await task.promise;
|
|
236
|
-
if (this.renderVersion !== version)
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
let contentEl = stageEl.querySelector('.pdf-content');
|
|
242
|
-
if (!contentEl) {
|
|
243
|
-
contentEl = document.createElement('div');
|
|
373
|
+
try {
|
|
374
|
+
if (isInitialBuild) {
|
|
375
|
+
stageEl.innerHTML = '';
|
|
376
|
+
const contentEl = document.createElement('div');
|
|
244
377
|
contentEl.className = 'pdf-content';
|
|
245
|
-
const pages = Array.from(stageEl.querySelectorAll('.pdf-page'));
|
|
246
|
-
for (const el of pages)
|
|
247
|
-
contentEl.appendChild(el);
|
|
248
378
|
stageEl.appendChild(contentEl);
|
|
379
|
+
for (let i = 1; i <= total; i++) {
|
|
380
|
+
const page = await this.doc.getPage(i);
|
|
381
|
+
const baseViewport = page.getViewport({ scale: 1 });
|
|
382
|
+
let baseScale = 1;
|
|
383
|
+
if (this.fit === 'width')
|
|
384
|
+
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
385
|
+
if (this.fit === 'page')
|
|
386
|
+
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
387
|
+
const minScale = baseScale * this.minZoom;
|
|
388
|
+
const maxScale = baseScale * this.maxZoom;
|
|
389
|
+
const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));
|
|
390
|
+
if (i === 1)
|
|
391
|
+
computedCanPan = finalScale > baseScale + 0.001;
|
|
392
|
+
const viewport = page.getViewport({ scale: finalScale });
|
|
393
|
+
const wrapper = document.createElement('div');
|
|
394
|
+
wrapper.className = 'pdf-page';
|
|
395
|
+
wrapper.setAttribute('data-page', String(i));
|
|
396
|
+
wrapper.style.width = Math.floor(viewport.width) + 'px';
|
|
397
|
+
wrapper.style.height = Math.floor(viewport.height) + 'px';
|
|
398
|
+
wrapper.style.margin = '0 auto 12px auto';
|
|
399
|
+
const canvas = document.createElement('canvas');
|
|
400
|
+
const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;
|
|
401
|
+
canvas.style.width = Math.floor(viewport.width) + 'px';
|
|
402
|
+
canvas.style.height = Math.floor(viewport.height) + 'px';
|
|
403
|
+
canvas.width = Math.floor(viewport.width * dpr);
|
|
404
|
+
canvas.height = Math.floor(viewport.height * dpr);
|
|
405
|
+
const ctx = canvas.getContext('2d');
|
|
406
|
+
wrapper.appendChild(canvas);
|
|
407
|
+
contentEl.appendChild(wrapper);
|
|
408
|
+
const renderCtx = { canvasContext: ctx, viewport };
|
|
409
|
+
if (dpr !== 1)
|
|
410
|
+
renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];
|
|
411
|
+
const task = page.render(renderCtx);
|
|
412
|
+
await task.promise;
|
|
413
|
+
if (this.renderVersion !== version)
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
249
416
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
417
|
+
else {
|
|
418
|
+
let contentEl = stageEl.querySelector('.pdf-content');
|
|
419
|
+
if (!contentEl) {
|
|
420
|
+
contentEl = document.createElement('div');
|
|
421
|
+
contentEl.className = 'pdf-content';
|
|
422
|
+
const pages = Array.from(stageEl.querySelectorAll('.pdf-page'));
|
|
423
|
+
for (const el of pages)
|
|
424
|
+
contentEl.appendChild(el);
|
|
425
|
+
stageEl.appendChild(contentEl);
|
|
426
|
+
}
|
|
427
|
+
for (let i = 1; i <= total; i++) {
|
|
428
|
+
const page = await this.doc.getPage(i);
|
|
429
|
+
const baseViewport = page.getViewport({ scale: 1 });
|
|
430
|
+
let baseScale = 1;
|
|
431
|
+
if (this.fit === 'width')
|
|
432
|
+
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
433
|
+
if (this.fit === 'page')
|
|
434
|
+
baseScale = (parentWidth - 16) / baseViewport.width;
|
|
435
|
+
const minScale = baseScale * this.minZoom;
|
|
436
|
+
const maxScale = baseScale * this.maxZoom;
|
|
437
|
+
const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));
|
|
438
|
+
if (i === 1)
|
|
439
|
+
computedCanPan = finalScale > baseScale + 0.001;
|
|
440
|
+
const viewport = page.getViewport({ scale: finalScale });
|
|
441
|
+
const wrapper = existing[i - 1];
|
|
442
|
+
const canvas = wrapper.querySelector('canvas');
|
|
443
|
+
wrapper.style.width = Math.floor(viewport.width) + 'px';
|
|
444
|
+
wrapper.style.height = Math.floor(viewport.height) + 'px';
|
|
445
|
+
const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;
|
|
446
|
+
canvas.style.width = Math.floor(viewport.width) + 'px';
|
|
447
|
+
canvas.style.height = Math.floor(viewport.height) + 'px';
|
|
448
|
+
canvas.width = Math.floor(viewport.width * dpr);
|
|
449
|
+
canvas.height = Math.floor(viewport.height * dpr);
|
|
450
|
+
const ctx = canvas.getContext('2d');
|
|
451
|
+
const renderCtx = { canvasContext: ctx, viewport };
|
|
452
|
+
if (dpr !== 1)
|
|
453
|
+
renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];
|
|
454
|
+
const task = page.render(renderCtx);
|
|
455
|
+
await task.promise;
|
|
456
|
+
if (this.renderVersion !== version)
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
281
459
|
}
|
|
460
|
+
this.canPan.set(computedCanPan);
|
|
461
|
+
if (anchor)
|
|
462
|
+
this.restoreScrollAnchor(stageEl, anchor);
|
|
463
|
+
}
|
|
464
|
+
finally {
|
|
465
|
+
this.renderLockCount = Math.max(0, this.renderLockCount - 1);
|
|
282
466
|
}
|
|
283
|
-
this.canPan.set(computedCanPan);
|
|
284
|
-
if (anchor)
|
|
285
|
-
this.restoreScrollAnchor(stageEl, anchor);
|
|
286
|
-
this.renderLockCount = Math.max(0, this.renderLockCount - 1);
|
|
287
467
|
}
|
|
288
468
|
async goTo(page) {
|
|
289
469
|
if (!this.doc)
|
|
@@ -786,8 +966,7 @@ class GenusPdfViewerComponent {
|
|
|
786
966
|
try {
|
|
787
967
|
let doc = this.doc;
|
|
788
968
|
if (!doc) {
|
|
789
|
-
|
|
790
|
-
doc = await task.promise;
|
|
969
|
+
doc = await this.loadDocumentWithFallbacks(this.src);
|
|
791
970
|
}
|
|
792
971
|
if (!doc)
|
|
793
972
|
return false;
|
|
@@ -844,7 +1023,11 @@ class GenusPdfViewerComponent {
|
|
|
844
1023
|
if (!href || typeof fetch === 'undefined')
|
|
845
1024
|
return null;
|
|
846
1025
|
try {
|
|
847
|
-
const res = await fetch(href, {
|
|
1026
|
+
const res = await fetch(href, {
|
|
1027
|
+
mode: 'cors',
|
|
1028
|
+
headers: this.httpHeaders,
|
|
1029
|
+
credentials: this.withCredentials ? 'include' : 'same-origin',
|
|
1030
|
+
});
|
|
848
1031
|
if (!res.ok)
|
|
849
1032
|
return null;
|
|
850
1033
|
const blob = await res.blob();
|
|
@@ -873,19 +1056,8 @@ class GenusPdfViewerComponent {
|
|
|
873
1056
|
const last = path.split('/').filter(Boolean).pop() || '';
|
|
874
1057
|
return last.endsWith('.pdf') ? last : (last ? last + '.pdf' : 'document.pdf');
|
|
875
1058
|
}
|
|
876
|
-
normalizePdfSource(src) {
|
|
877
|
-
if (typeof src === 'string') {
|
|
878
|
-
try {
|
|
879
|
-
return new URL(src, typeof window !== 'undefined' ? window.location?.href : undefined);
|
|
880
|
-
}
|
|
881
|
-
catch {
|
|
882
|
-
return src;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return src;
|
|
886
|
-
}
|
|
887
1059
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: GenusPdfViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
888
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: GenusPdfViewerComponent, isStandalone: true, selector: "genus-pdf-viewer", inputs: { src: "src", page: "page", zoom: "zoom", maxZoom: "maxZoom", minZoom: "minZoom", fit: "fit", disableTextLayer: "disableTextLayer", continuous: "continuous", showToolbar: "showToolbar", zoomAnimation: "zoomAnimation", zoomAnimationMs: "zoomAnimationMs", gestureAnimationMs: "gestureAnimationMs" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }, { propertyName: "singleStage", first: true, predicate: ["singleStage"], descendants: true }, { propertyName: "stage", first: true, predicate: ["stage"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1060
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: GenusPdfViewerComponent, isStandalone: true, selector: "genus-pdf-viewer", inputs: { src: "src", page: "page", zoom: "zoom", maxZoom: "maxZoom", minZoom: "minZoom", fit: "fit", disableTextLayer: "disableTextLayer", continuous: "continuous", showToolbar: "showToolbar", zoomAnimation: "zoomAnimation", zoomAnimationMs: "zoomAnimationMs", gestureAnimationMs: "gestureAnimationMs", loadTimeoutMs: "loadTimeoutMs", withCredentials: "withCredentials", httpHeaders: "httpHeaders" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }, { propertyName: "singleStage", first: true, predicate: ["singleStage"], descendants: true }, { propertyName: "stage", first: true, predicate: ["stage"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
889
1061
|
<div class="genus-pdf-shell">
|
|
890
1062
|
<ng-content select="[toolbar]"></ng-content>
|
|
891
1063
|
|
|
@@ -1000,6 +1172,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
1000
1172
|
type: Input
|
|
1001
1173
|
}], gestureAnimationMs: [{
|
|
1002
1174
|
type: Input
|
|
1175
|
+
}], loadTimeoutMs: [{
|
|
1176
|
+
type: Input
|
|
1177
|
+
}], withCredentials: [{
|
|
1178
|
+
type: Input
|
|
1179
|
+
}], httpHeaders: [{
|
|
1180
|
+
type: Input
|
|
1003
1181
|
}], canvas: [{
|
|
1004
1182
|
type: ViewChild,
|
|
1005
1183
|
args: ['canvas', { static: false }]
|
|
@@ -1012,28 +1190,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
1012
1190
|
}] } });
|
|
1013
1191
|
|
|
1014
1192
|
const GENUS_PDF_WORKER_CONFIG = new InjectionToken('GENUS_PDF_WORKER_CONFIG');
|
|
1193
|
+
function resolveBundledWorkerUrl() {
|
|
1194
|
+
try {
|
|
1195
|
+
return new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
|
1196
|
+
}
|
|
1197
|
+
catch {
|
|
1198
|
+
return null;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1015
1201
|
function initPdfWorkerFactory(cfg, platformId) {
|
|
1016
|
-
return () => {
|
|
1202
|
+
return async () => {
|
|
1017
1203
|
if (!isPlatformBrowser(platformId))
|
|
1018
1204
|
return;
|
|
1019
1205
|
const defaults = {
|
|
1020
1206
|
tryModuleWorker: true,
|
|
1021
|
-
workerSrc: '/assets/pdf.worker.min.mjs',
|
|
1022
1207
|
};
|
|
1023
1208
|
const merged = { ...defaults, ...cfg };
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
return;
|
|
1030
|
-
}
|
|
1209
|
+
const globalOptions = pdfjsLib.GlobalWorkerOptions;
|
|
1210
|
+
globalOptions.workerPort = null;
|
|
1211
|
+
if (typeof merged.workerSrc === 'string' && merged.workerSrc.length > 0) {
|
|
1212
|
+
globalOptions.workerSrc = merged.workerSrc;
|
|
1213
|
+
return;
|
|
1031
1214
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1215
|
+
if (!merged.tryModuleWorker) {
|
|
1216
|
+
globalOptions.workerSrc = '/assets/pdf.worker.min.mjs';
|
|
1217
|
+
return;
|
|
1034
1218
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1219
|
+
const bundledWorkerUrl = resolveBundledWorkerUrl();
|
|
1220
|
+
globalOptions.workerSrc = bundledWorkerUrl || '/assets/pdf.worker.min.mjs';
|
|
1037
1221
|
};
|
|
1038
1222
|
}
|
|
1039
1223
|
function provideGenusPdfViewer(cfg = {}) {
|
|
@@ -1042,7 +1226,8 @@ function provideGenusPdfViewer(cfg = {}) {
|
|
|
1042
1226
|
{
|
|
1043
1227
|
provide: APP_INITIALIZER,
|
|
1044
1228
|
multi: true,
|
|
1045
|
-
useFactory:
|
|
1229
|
+
useFactory: initPdfWorkerFactory,
|
|
1230
|
+
deps: [GENUS_PDF_WORKER_CONFIG, PLATFORM_ID],
|
|
1046
1231
|
},
|
|
1047
1232
|
];
|
|
1048
1233
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genus-pdf-viewer.mjs","sources":["../../../projects/genus-pdf-viewer/src/lib/genus-pdf-viewer.ts","../../../projects/genus-pdf-viewer/src/lib/pdfjs-worker.provider.ts","../../../projects/genus-pdf-viewer/src/public-api.ts","../../../projects/genus-pdf-viewer/src/genus-pdf-viewer.ts"],"sourcesContent":["import { Component, Input, ViewChild, ElementRef, OnChanges, SimpleChanges, effect, signal } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport * as pdfjsLib from 'pdfjs-dist';\nimport type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist/types/src/display/api';\n\n@Component({\n selector: 'genus-pdf-viewer',\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"genus-pdf-shell\">\n <ng-content select=\"[toolbar]\"></ng-content>\n\n <div class=\"genus-pdf-toolbar\" *ngIf=\"showToolbar\">\n <button type=\"button\" title=\"Zoom out\" aria-label=\"Zoom out\" (click)=\"zoomOut()\">−</button>\n <span class=\"pct\">{{ (zoomSig() * 100) | number:'1.0-0' }}%</span>\n <button type=\"button\" title=\"Zoom in\" aria-label=\"Zoom in\" (click)=\"zoomIn()\">+</button>\n <button type=\"button\" *ngIf=\"isZoomed()\" title=\"Reset zoom to 100%\" aria-label=\"Reset zoom to 100%\" (click)=\"resetZoom()\">100%</button>\n <span class=\"spacer\"></span>\n <button type=\"button\" title=\"Previous page\" aria-label=\"Previous page\" (click)=\"prevPage()\" [disabled]=\"pageSig() <= 1\">⟨</button>\n <span>{{ pageSig() }} / {{ doc ? doc.numPages : 0 }}</span>\n <button type=\"button\" title=\"Next page\" aria-label=\"Next page\" (click)=\"nextPage()\" [disabled]=\"doc ? pageSig() >= doc.numPages : true\">⟩</button>\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"download-btn\" title=\"Download\" aria-label=\"Download\" (click)=\"download()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M12 3v10m0 0 4-4m-4 4-4-4M5 15v3a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-3\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span>Download</span>\n </button>\n </div>\n\n <div class=\"genus-pdf-stage\" #singleStage [style.display]=\"continuous ? 'none' : 'flex'\" [class.can-pan]=\"canPan()\" [class.is-panning]=\"isPanning()\" (pointerdown)=\"onPointerDown($event, singleStage)\" (wheel)=\"onWheel($event, singleStage)\" (scroll)=\"onScroll($event)\">\n <div class=\"genus-pdf-overlay\" *ngIf=\"loading()\"><div class=\"spinner\" aria-label=\"Loading\"></div></div>\n <div class=\"genus-pdf-overlay error\" *ngIf=\"error()\">\n <div style=\"display:flex;flex-direction:column;gap:8px;align-items:center;\">\n <span>{{ error() }}</span>\n <button type=\"button\" (click)=\"retryLoad()\">Retry</button>\n </div>\n </div>\n <canvas #canvas></canvas>\n </div>\n\n <div class=\"genus-pdf-stage genus-pdf-stage--continuous\" #stage [style.display]=\"continuous ? 'block' : 'none'\" [class.can-pan]=\"canPan()\" [class.is-panning]=\"isPanning()\" (pointerdown)=\"onPointerDown($event, stage)\" (wheel)=\"onWheel($event, stage)\" (scroll)=\"onScroll($event)\">\n <div class=\"genus-pdf-overlay\" *ngIf=\"loading()\"><div class=\"spinner\" aria-label=\"Loading\"></div></div>\n <div class=\"genus-pdf-overlay error\" *ngIf=\"error()\">\n <div style=\"display:flex;flex-direction:column;gap:8px;align-items:center;\">\n <span>{{ error() }}</span>\n <button type=\"button\" (click)=\"retryLoad()\">Retry</button>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [`\n .genus-pdf-shell { display:flex; flex-direction:column; gap:8px; width:100%; height:100%; background:#f3f4f6; }\n .genus-pdf-toolbar { position:sticky; top:0; z-index:2; display:flex; align-items:center; gap:8px; padding:6px 8px; border:1px solid #e5e7eb; border-radius:8px; background:#ffffffd9; backdrop-filter:saturate(1.2) blur(6px); box-shadow:0 1px 2px rgba(0,0,0,0.06); }\n .genus-pdf-toolbar .pct { min-width: 48px; text-align:center; font-variant-numeric: tabular-nums; color:#111827; }\n .genus-pdf-toolbar button { appearance:none; border:1px solid #e5e7eb; background:#fff; padding:6px 10px; border-radius:6px; cursor:pointer; color:#111827; font-size:14px; line-height:1; font-weight:500; min-width:32px; user-select:none; display:inline-flex; align-items:center; gap:6px; }\n .genus-pdf-toolbar button.download-btn { background:#2563eb; border-color:#2563eb; color:#fff; }\n .genus-pdf-toolbar button.download-btn:hover { background:#1d4ed8; border-color:#1d4ed8; }\n .genus-pdf-toolbar button:disabled { opacity:0.5; cursor:not-allowed; }\n .genus-pdf-toolbar .spacer { flex:1; }\n .genus-pdf-stage { position:relative; flex:1; overflow:auto; display:flex; align-items:flex-start; justify-content:center; background:#fafafa; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; overscroll-behavior-y: contain; }\n .genus-pdf-stage.can-pan { cursor: grab; touch-action: none; }\n .genus-pdf-stage.is-panning { cursor: grabbing; }\n .genus-pdf-stage--continuous { display:block; align-items:unset; justify-content:unset; padding:8px; scroll-behavior:smooth; }\n .genus-pdf-stage--continuous .pdf-page { margin:0 auto 12px auto; background:white; box-shadow:0 1px 2px rgba(0,0,0,0.08); }\n canvas { display:block; max-width:100%; height:auto; }\n .genus-pdf-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,0.7); z-index:1; }\n .genus-pdf-overlay.error { background:transparent; }\n .spinner { width:28px; height:28px; border-radius:50%; border:3px solid #e5e7eb; border-top-color:#111827; animation:spin 1s linear infinite; }\n @keyframes spin { from { transform: rotate(0) } to { transform: rotate(360deg) } }\n `]\n})\nexport class GenusPdfViewerComponent implements OnChanges {\n @Input() src!: string | URL | Uint8Array | Blob;\n @Input() page = 1;\n @Input() zoom = 1.0;\n @Input() maxZoom = 4;\n @Input() minZoom = 0.25;\n @Input() fit: 'width'|'height'|'page'|'none' = 'width';\n @Input() disableTextLayer = true;\n @Input() continuous = true;\n @Input() showToolbar = true;\n @Input() zoomAnimation = true;\n @Input() zoomAnimationMs = 180;\n @Input() gestureAnimationMs = 120;\n\n @ViewChild('canvas', { static: false }) canvas!: ElementRef<HTMLCanvasElement>;\n @ViewChild('singleStage', { static: false }) singleStage!: ElementRef<HTMLDivElement>;\n @ViewChild('stage', { static: false }) stage!: ElementRef<HTMLDivElement>;\n\n doc?: PDFDocumentProxy;\n private currentPage?: PDFPageProxy;\n\n pageSig = signal(1);\n zoomSig = signal(1);\n isPanning = signal(false);\n canPan = signal(false);\n loading = signal(false);\n error = signal<string | null>(null);\n private readonly PRINT_SCALE = 2;\n private scrollRaf = 0 as any;\n private renderLockCount = 0;\n private zoomAnimInFlight = false;\n private activeRenderTasks = new Set<any>();\n private wheelRaf = 0 as any;\n private pinchState: { id1: number; id2: number; startDist: number; startZoom: number } | null = null;\n private activePointers = new Map<number, { x: number; y: number; type: string }>();\n private renderVersion = 0;\n private previewActive = false;\n private reRenderQueued = false;\n private pendingAnchor: { page: number; ratio: number } | undefined;\n private lastZoomClient: { x: number; y: number } | null = null;\n private readonly WHEEL_STEP = 0.02;\n private readonly PINCH_SENSITIVITY = 0.5;\n private wheelCommitTimer = 0 as any;\n \n\n constructor() {\n effect(() => {\n // Only react to zoom changes here; page changes in continuous mode should NOT trigger a re-render\n this.zoomSig();\n if (this.renderLockCount > 0 || this.previewActive) return;\n this.safeRender();\n });\n }\n\n async ngOnChanges(changes: SimpleChanges) {\n if (changes['page']) this.pageSig.set(this.page);\n if (changes['zoom']) this.zoomSig.set(this.zoom);\n\n const srcChanged = !!changes['src'];\n const layoutChanged = !!(changes['fit'] || changes['minZoom'] || changes['maxZoom']);\n\n if (!this.src) return;\n\n if (srcChanged) {\n await this.loadDocument();\n\n if (this.doc) {\n const pages = this.doc.numPages;\n if (this.pageSig() < 1) this.pageSig.set(1);\n if (this.pageSig() > pages) this.pageSig.set(pages);\n await this.render();\n }\n return;\n }\n\n if (layoutChanged) {\n if (this.continuous) {\n const container = this.stage?.nativeElement;\n const anchor = container ? this.captureScrollAnchor(container) || undefined : undefined;\n await this.renderAllPages(anchor);\n } else {\n await this.render();\n }\n return;\n }\n\n if (!this.continuous && changes['page']) {\n await this.render();\n }\n }\n\n async safeRender() {\n try { await this.render(); } catch (_) {}\n }\n\n private async loadDocument() {\n this.loading.set(true);\n this.error.set(null);\n try {\n const task = pdfjsLib.getDocument(this.normalizePdfSource(this.src) as any);\n this.doc = await task.promise;\n } catch (e) {\n // Fallback for environments (notably some iOS builds) where range/streaming fetch fails.\n // Try fetching the whole file via fetch() and pass ArrayBuffer to pdf.js.\n try {\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (href && typeof fetch !== 'undefined') {\n const res = await fetch(href, { mode: 'cors' });\n if (res.ok) {\n const ab = await res.arrayBuffer();\n const data = new Uint8Array(ab);\n const task2 = pdfjsLib.getDocument({ data } as any);\n this.doc = await task2.promise;\n } else {\n this.doc = undefined;\n }\n } else {\n this.doc = undefined;\n }\n } catch {\n this.doc = undefined;\n }\n if (!this.doc) this.error.set('Failed to load PDF');\n } finally {\n this.loading.set(false);\n }\n }\n\n async render() {\n if (!this.doc) return;\n const version = ++this.renderVersion;\n if (this.continuous) {\n await this.renderAllPages();\n return;\n }\n\n const pageNum = this.pageSig();\n const pdfPage = await this.doc.getPage(pageNum);\n this.currentPage = pdfPage;\n\n const canvas = this.canvas?.nativeElement;\n if (!canvas) return;\n const ctx = canvas.getContext('2d')!;\n\n const baseViewport = pdfPage.getViewport({ scale: 1 });\n const parent = canvas.parentElement!;\n const anchor = this.captureScrollAnchor(parent) || undefined;\n const pW = parent.clientWidth, pH = parent.clientHeight || baseViewport.height;\n\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (pW - 16) / baseViewport.width;\n if (this.fit === 'height') baseScale = (pH - 16) / baseViewport.height;\n if (this.fit === 'page') baseScale = Math.min((pW - 16) / baseViewport.width, (pH - 16) / baseViewport.height);\n\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n this.canPan.set(finalScale > baseScale + 0.001);\n const viewport = pdfPage.getViewport({ scale: finalScale });\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = pdfPage.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n if (anchor) this.restoreScrollAnchor(parent, anchor);\n }\n\n private async renderAllPages(anchorOverride?: { page: number; ratio: number }) {\n if (!this.doc) return;\n const stageEl = this.stage?.nativeElement;\n if (!stageEl) return;\n const version = ++this.renderVersion;\n const anchor = anchorOverride ?? this.captureScrollAnchor(stageEl);\n const total = this.doc.numPages;\n const parentRect = stageEl.getBoundingClientRect();\n const parentWidth = parentRect.width || stageEl.clientWidth || 800;\n let computedCanPan = false;\n const existing = Array.from(stageEl.querySelectorAll<HTMLElement>('.pdf-page'));\n const isInitialBuild = existing.length !== total;\n this.renderLockCount++;\n if (isInitialBuild) {\n stageEl.innerHTML = '';\n const contentEl = document.createElement('div');\n contentEl.className = 'pdf-content';\n stageEl.appendChild(contentEl);\n for (let i = 1; i <= total; i++) {\n const page = await this.doc.getPage(i);\n const baseViewport = page.getViewport({ scale: 1 });\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (parentWidth - 16) / baseViewport.width;\n if (this.fit === 'page') baseScale = (parentWidth - 16) / baseViewport.width;\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n if (i === 1) computedCanPan = finalScale > baseScale + 0.001;\n const viewport = page.getViewport({ scale: finalScale });\n\n const wrapper = document.createElement('div');\n wrapper.className = 'pdf-page';\n wrapper.setAttribute('data-page', String(i));\n wrapper.style.width = Math.floor(viewport.width) + 'px';\n wrapper.style.height = Math.floor(viewport.height) + 'px';\n wrapper.style.margin = '0 auto 12px auto';\n\n const canvas = document.createElement('canvas');\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const ctx = canvas.getContext('2d')!;\n\n wrapper.appendChild(canvas);\n contentEl.appendChild(wrapper);\n\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = page.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n }\n } else {\n let contentEl = stageEl.querySelector<HTMLElement>('.pdf-content');\n if (!contentEl) {\n contentEl = document.createElement('div');\n contentEl.className = 'pdf-content';\n const pages = Array.from(stageEl.querySelectorAll<HTMLElement>('.pdf-page'));\n for (const el of pages) contentEl.appendChild(el);\n stageEl.appendChild(contentEl);\n }\n for (let i = 1; i <= total; i++) {\n const page = await this.doc.getPage(i);\n const baseViewport = page.getViewport({ scale: 1 });\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (parentWidth - 16) / baseViewport.width;\n if (this.fit === 'page') baseScale = (parentWidth - 16) / baseViewport.width;\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n if (i === 1) computedCanPan = finalScale > baseScale + 0.001;\n const viewport = page.getViewport({ scale: finalScale });\n\n const wrapper = existing[i - 1];\n const canvas = wrapper.querySelector('canvas') as HTMLCanvasElement;\n wrapper.style.width = Math.floor(viewport.width) + 'px';\n wrapper.style.height = Math.floor(viewport.height) + 'px';\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const ctx = canvas.getContext('2d')!;\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = page.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n }\n }\n this.canPan.set(computedCanPan);\n if (anchor) this.restoreScrollAnchor(stageEl, anchor);\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n }\n\n async goTo(page: number) {\n if (!this.doc) return;\n const p = Math.max(1, Math.min(this.doc.numPages, page));\n this.pageSig.set(p);\n if (this.continuous) {\n const stageEl = this.stage?.nativeElement;\n const el = stageEl?.querySelector(`[data-page=\"${p}\"]`) as HTMLElement | null;\n el?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n } else {\n await this.render();\n }\n }\n async zoomIn(step = 0.1) { await this.applyZoomDelta(step); }\n async zoomOut(step = 0.1) { await this.applyZoomDelta(-step); }\n\n private clampZoom(z: number): number {\n return Math.max(this.minZoom, Math.min(this.maxZoom, z));\n }\n\n private cancelPreviewIfAny(container?: HTMLElement): void {\n if (!this.previewActive || !container) return;\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n try {\n target.style.transform = '';\n target.style.willChange = '';\n target.style.transition = '';\n } catch {}\n this.previewActive = false;\n this.lastZoomClient = null;\n }\n\n private async applyZoomDelta(delta: number): Promise<void> {\n const oldZoom = this.zoomSig();\n const newZoom = this.clampZoom(oldZoom + delta);\n if (Math.abs(newZoom - oldZoom) < 0.0001) return;\n\n const container = this.continuous ? this.stage?.nativeElement : this.singleStage?.nativeElement;\n // If a preview transform is active (from pinch/wheel), clear it before capturing anchor or animating\n this.cancelPreviewIfAny(container);\n const anchor = container ? this.captureScrollAnchor(container) || undefined : undefined;\n const ratio = newZoom / oldZoom;\n\n if (this.zoomAnimation && container && !this.zoomAnimInFlight) {\n this.zoomAnimInFlight = true;\n this.renderLockCount++;\n // Update UI value immediately\n this.zoomSig.set(newZoom);\n try {\n await this.runZoomAnimation(container, ratio);\n } finally {\n // Release the render lock before triggering the actual re-render\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n await this.safeReRenderWithCancellation(anchor);\n this.zoomAnimInFlight = false;\n }\n } else {\n this.zoomSig.set(newZoom);\n await this.safeReRenderWithCancellation(anchor);\n }\n }\n\n private async runZoomAnimation(container: HTMLElement, ratio: number): Promise<void> {\n if (Math.abs(ratio - 1) < 0.0001) return;\n const { target, originX, originY } = this.getZoomAnimTarget(container);\n return new Promise<void>((resolve) => {\n try {\n const onDone = () => {\n cleanup();\n resolve();\n };\n const cleanup = () => {\n target.removeEventListener('transitionend', onEnd as any);\n target.style.transition = '';\n target.style.transform = '';\n target.style.transformOrigin = '';\n target.style.willChange = '';\n };\n const onEnd = () => onDone();\n target.style.willChange = 'transform';\n target.style.transformOrigin = `${Math.max(0, originX)}px ${Math.max(0, originY)}px`;\n target.style.transition = 'none';\n target.style.transform = 'scale(1)';\n requestAnimationFrame(() => {\n target.addEventListener('transitionend', onEnd as any, { once: true } as any);\n target.style.transition = `transform ${this.zoomAnimationMs}ms cubic-bezier(0.2,0,0,1)`;\n target.style.transform = `scale(${ratio})`;\n setTimeout(onDone, this.zoomAnimationMs + 60);\n });\n } catch {\n resolve();\n }\n });\n }\n\n private getZoomAnimTarget(container: HTMLElement): { target: HTMLElement; originX: number; originY: number } {\n const isContinuous = this.continuous;\n let target: HTMLElement | null = null;\n if (isContinuous) {\n target = container.querySelector<HTMLElement>('.pdf-content');\n if (!target) target = container; // fallback\n } else {\n target = container.querySelector<HTMLElement>('canvas');\n if (!target) target = container; // fallback\n }\n const rectLeft = target.offsetLeft;\n const rectTop = target.offsetTop;\n // Prefer last gesture point (pinch center or wheel pointer) if available\n const client = this.lastZoomClient;\n const originX = client ? (container.scrollLeft + client.x - rectLeft) : (container.scrollLeft + container.clientWidth / 2 - rectLeft);\n const originY = client ? (container.scrollTop + client.y - rectTop) : (container.scrollTop + container.clientHeight / 2 - rectTop);\n return { target, originX, originY };\n }\n\n onScroll(evt: Event) {\n const container = evt.target as HTMLElement;\n // debounce via rAF\n if (this.scrollRaf) cancelAnimationFrame(this.scrollRaf);\n this.scrollRaf = requestAnimationFrame(() => {\n if (!this.doc || !this.continuous) return;\n const pages = Array.from(container.querySelectorAll<HTMLElement>('.pdf-page'));\n if (!pages.length) return;\n const centerY = container.scrollTop + container.clientHeight / 2;\n let current = this.pageSig();\n for (const el of pages) {\n const top = el.offsetTop;\n const bottom = top + el.offsetHeight;\n if (centerY >= top && centerY <= bottom) {\n const p = parseInt(el.getAttribute('data-page') || '1', 10);\n current = p;\n break;\n }\n }\n if (current !== this.pageSig()) this.pageSig.set(current);\n });\n }\n\n async nextPage() { await this.goTo(this.pageSig() + 1); }\n async prevPage() { await this.goTo(this.pageSig() - 1); }\n\n isZoomed(): boolean {\n return Math.abs(this.zoomSig() - 1) > 0.0001;\n }\n\n async resetZoom() {\n // Reset to exactly 1.0 (100%)\n const delta = 1 - this.zoomSig();\n await this.applyZoomDelta(delta);\n }\n\n async retryLoad() {\n await this.loadDocument();\n if (this.doc) {\n const pages = this.doc.numPages;\n if (this.pageSig() < 1) this.pageSig.set(1);\n if (this.pageSig() > pages) this.pageSig.set(pages);\n await this.render();\n }\n }\n\n onPointerDown(evt: PointerEvent, containerEl: HTMLElement) {\n // Pinch-to-zoom (two pointers)\n if (evt.pointerType === 'touch') {\n this.activePointers.set(evt.pointerId, { x: evt.clientX, y: evt.clientY, type: evt.pointerType });\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerType === 'touch') this.activePointers.set(e.pointerId, { x: e.clientX, y: e.clientY, type: e.pointerType });\n const touches = Array.from(this.activePointers.entries()).map(([id, p]) => ({ pointerId: id, clientX: p.x, clientY: p.y }))\n .slice(0, 2);\n if (touches.length === 2) {\n const [a, b] = touches;\n const dist = Math.hypot(a.clientX - b.clientX, a.clientY - b.clientY);\n if (!this.pinchState) {\n this.pinchState = { id1: a.pointerId, id2: b.pointerId, startDist: Math.max(1, dist), startZoom: this.zoomSig() };\n const rect = containerEl.getBoundingClientRect();\n this.lastZoomClient = { x: ((a.clientX + b.clientX) / 2) - rect.left, y: ((a.clientY + b.clientY) / 2) - rect.top };\n }\n const scale = dist / Math.max(1, this.pinchState.startDist);\n const adjusted = 1 + (scale - 1) * this.PINCH_SENSITIVITY;\n const desiredAdj = this.clampZoom(this.pinchState.startZoom * adjusted);\n this.previewZoom(containerEl, desiredAdj);\n e.preventDefault();\n return;\n }\n // When pinch ends (not exactly two touches), commit render if we were previewing\n if (this.pinchState) {\n const final = this.zoomSig();\n this.commitPreviewZoom(containerEl, final);\n this.pinchState = null;\n this.lastZoomClient = null;\n }\n };\n const onPointerEnd = (e: PointerEvent) => {\n this.activePointers.delete(e.pointerId);\n const touches = Array.from(this.activePointers.values());\n if (touches.length !== 2 && this.pinchState) {\n const final = this.zoomSig();\n this.commitPreviewZoom(containerEl, final);\n this.pinchState = null;\n this.lastZoomClient = null;\n }\n cleanup();\n };\n const cleanup = () => {\n containerEl.removeEventListener('pointermove', onPointerMove);\n containerEl.removeEventListener('pointerup', onPointerEnd);\n containerEl.removeEventListener('pointercancel', onPointerEnd);\n this.activePointers.clear();\n };\n containerEl.addEventListener('pointermove', onPointerMove);\n containerEl.addEventListener('pointerup', onPointerEnd);\n containerEl.addEventListener('pointercancel', onPointerEnd);\n return;\n }\n\n // Mouse pan when canPan\n if (!this.canPan()) return;\n this.isPanning.set(true);\n const startX = evt.clientX;\n const startY = evt.clientY;\n const startLeft = containerEl.scrollLeft;\n const startTop = containerEl.scrollTop;\n containerEl.style.scrollBehavior = 'auto';\n containerEl.setPointerCapture?.(evt.pointerId);\n const move = (e: PointerEvent) => {\n const dx = e.clientX - startX;\n const dy = e.clientY - startY;\n containerEl.scrollLeft = startLeft - dx;\n containerEl.scrollTop = startTop - dy;\n e.preventDefault();\n };\n const end = (e: PointerEvent) => {\n this.isPanning.set(false);\n containerEl.releasePointerCapture?.(evt.pointerId);\n containerEl.removeEventListener('pointermove', move);\n containerEl.removeEventListener('pointerup', end);\n containerEl.removeEventListener('pointercancel', end);\n containerEl.style.scrollBehavior = 'smooth';\n };\n containerEl.addEventListener('pointermove', move);\n containerEl.addEventListener('pointerup', end);\n containerEl.addEventListener('pointercancel', end);\n }\n\n private getActiveTouches(containerEl: HTMLElement): PointerEvent[] {\n // We capture pointer events only on this element; maintain list by querying PointerEvent.getCoalescedEvents not available broadly.\n // Instead, rely on touches reported in native events; browsers will deliver move events for all active pointers targeting the element.\n // Here we cannot query directly; so we return an empty array and use move handler state. For simplicity, we derive from event stream only.\n // This helper remains for future extension; current logic passes actual events to compute pinch.\n return [] as any;\n }\n\n onWheel(evt: WheelEvent, containerEl: HTMLElement) {\n const isCtrlZoom = evt.ctrlKey || evt.metaKey;\n if (!isCtrlZoom) return;\n evt.preventDefault();\n const rect = containerEl.getBoundingClientRect();\n // Record gesture point relative to container\n this.lastZoomClient = { x: evt.clientX - rect.left, y: evt.clientY - rect.top };\n if (this.wheelRaf) cancelAnimationFrame(this.wheelRaf);\n if (this.wheelCommitTimer) clearTimeout(this.wheelCommitTimer);\n const delta = -evt.deltaY;\n const step = delta > 0 ? this.WHEEL_STEP : -this.WHEEL_STEP;\n const desired = this.clampZoom(this.zoomSig() + step);\n this.previewZoom(containerEl, desired);\n this.wheelRaf = requestAnimationFrame(() => {\n this.wheelCommitTimer = setTimeout(() => {\n this.commitPreviewZoom(containerEl, this.zoomSig());\n this.lastZoomClient = null;\n }, this.gestureAnimationMs + 20);\n });\n }\n\n private previewZoom(container: HTMLElement, newZoom: number) {\n const oldZoom = this.zoomSig();\n if (Math.abs(newZoom - oldZoom) < 0.0001) return;\n const ratio = newZoom / oldZoom;\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n const origin = this.getZoomAnimTarget(container);\n target.style.willChange = 'transform';\n target.style.transformOrigin = `${Math.max(0, origin.originX)}px ${Math.max(0, origin.originY)}px`;\n target.style.transition = `transform ${this.gestureAnimationMs}ms cubic-bezier(0.2,0,0,1)`;\n target.style.transform = `scale(${ratio})`;\n this.zoomSig.set(newZoom);\n this.previewActive = true;\n }\n\n private async commitPreviewZoom(container: HTMLElement, expectedZoom: number) {\n // Clear transform and re-render once; cancel any in-flight render tasks\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n target.style.transform = '';\n target.style.willChange = '';\n target.style.transition = '';\n const anchor = this.captureScrollAnchor(container) || undefined;\n if (this.previewActive) {\n await this.safeReRenderWithCancellation(anchor);\n this.previewActive = false;\n }\n }\n\n private async safeReRenderWithCancellation(anchor?: { page: number; ratio: number }) {\n // If a render is in progress, queue once with the most recent anchor\n if (this.renderLockCount > 0) {\n this.reRenderQueued = true;\n if (anchor) this.pendingAnchor = anchor;\n return;\n }\n try {\n this.renderLockCount++;\n if (this.continuous) {\n await this.renderAllPages(anchor);\n } else {\n await this.render();\n }\n } finally {\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n if (this.renderLockCount === 0 && this.reRenderQueued) {\n const nextAnchor = this.pendingAnchor;\n this.reRenderQueued = false;\n this.pendingAnchor = undefined;\n await this.safeReRenderWithCancellation(nextAnchor);\n }\n }\n }\n\n private captureScrollAnchor(container: HTMLElement, client?: { x: number; y: number } | null): { page: number; ratio: number } | null {\n try {\n const pages = Array.from(container.querySelectorAll<HTMLElement>('.pdf-page'));\n const centerY = container.scrollTop + container.clientHeight / 2;\n if (pages.length > 0) {\n let pageEl = pages.find(el => (el.offsetTop <= centerY && (el.offsetTop + el.offsetHeight) >= centerY))\n || pages.find(el => (el.offsetTop + el.offsetHeight) > (container.scrollTop + 1))\n || pages[0];\n const page = parseInt(pageEl.getAttribute('data-page') || '1', 10);\n const height = Math.max(1, pageEl.offsetHeight);\n const ratio = Math.max(0, Math.min(1, (centerY - pageEl.offsetTop) / height));\n return { page, ratio };\n }\n // Fallback: single-canvas mode\n const canvas = container.querySelector('canvas');\n if (!canvas) return null;\n const height = Math.max(1, (canvas as HTMLElement).offsetHeight);\n const ratio = Math.max(0, Math.min(1, (centerY - (canvas as HTMLElement).offsetTop) / height));\n return { page: 1, ratio };\n } catch {\n return null;\n }\n }\n\n private restoreScrollAnchor(container: HTMLElement, anchor: { page: number; ratio: number }): void {\n try {\n let el = container.querySelector<HTMLElement>(`[data-page=\"${anchor.page}\"]`);\n if (!el) el = container.querySelector<HTMLElement>('canvas');\n if (!el) return;\n const prevBehavior = container.style.scrollBehavior;\n container.style.scrollBehavior = 'auto';\n const height = Math.max(1, el.offsetHeight);\n const desired = el.offsetTop + anchor.ratio * height - container.clientHeight / 2;\n const maxScroll = Math.max(0, container.scrollHeight - container.clientHeight);\n container.scrollTop = Math.max(0, Math.min(maxScroll, desired));\n container.style.scrollBehavior = prevBehavior;\n } catch {}\n }\n\n async download() {\n const filename = this.deriveFilename();\n const link = document.createElement('a');\n const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && (navigator as any).maxTouchPoints > 1);\n let popup: Window | null = null;\n if (isIOS) {\n // Open a tab synchronously to stay within user gesture\n try { popup = window.open('', '_blank', 'noopener,noreferrer'); } catch { popup = null; }\n }\n\n const blob = await this.createBlobFromSrc();\n if (blob) {\n const url = URL.createObjectURL(blob);\n if (isIOS) {\n if (popup) {\n try { popup.location.href = url; } catch { /* ignore */ }\n // Revoke later to allow the view to load fully\n setTimeout(() => URL.revokeObjectURL(url), 30000);\n } else {\n const a = document.createElement('a');\n a.href = url;\n a.target = '_blank';\n a.rel = 'noopener';\n document.body.appendChild(a);\n a.click();\n a.remove();\n setTimeout(() => URL.revokeObjectURL(url), 30000);\n }\n } else {\n link.href = url;\n link.download = filename;\n link.rel = 'noopener';\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n link.remove();\n URL.revokeObjectURL(url);\n }\n return;\n }\n\n // Fallback: cross-origin without CORS\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (!href) return;\n if (isIOS) {\n if (popup) {\n try { popup.location.href = href; } catch { /* ignore */ }\n } else {\n const a = document.createElement('a');\n a.href = href;\n a.target = '_blank';\n a.rel = 'noopener';\n document.body.appendChild(a);\n a.click();\n a.remove();\n }\n } else {\n link.href = href;\n link.target = '_blank';\n link.rel = 'noopener';\n link.download = filename; // browsers may ignore for cross-origin\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n link.remove();\n }\n }\n\n async print() {\n // Robust, plugin-free printing by rendering pages to images\n const ok = await this.printViaImages();\n if (ok) return;\n // Fallbacks\n const blob = await this.createBlobFromSrc();\n if (blob) {\n const url = URL.createObjectURL(blob);\n const win = window.open('', '_blank', 'noopener,noreferrer');\n if (win) {\n win.document.write('<!doctype html><html><head><title>Print</title><meta charset=\"utf-8\"><style>html,body{height:100%;margin:0}@page{size:auto;margin:0} iframe{border:0;width:100%;height:100%}</style></head><body><iframe src=\"' + url + '\"></iframe></body></html>');\n win.document.close();\n setTimeout(() => { try { win.focus(); win.print(); } catch {} }, 800);\n win.onafterprint = () => { try { win.close(); } catch {} URL.revokeObjectURL(url); };\n } else {\n const iframe = document.createElement('iframe');\n iframe.style.position = 'fixed'; iframe.style.right = '0'; iframe.style.bottom = '0';\n iframe.style.width = '0'; iframe.style.height = '0'; iframe.style.border = '0';\n iframe.src = url; document.body.appendChild(iframe);\n iframe.onload = () => { try { setTimeout(() => iframe.contentWindow?.print(), 800); } catch {} setTimeout(() => { URL.revokeObjectURL(url); iframe.remove(); }, 3000); };\n }\n return;\n }\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (href) window.open(href, '_blank');\n }\n\n private async printViaImages(): Promise<boolean> {\n try {\n let doc = this.doc;\n if (!doc) {\n const task = pdfjsLib.getDocument(this.normalizePdfSource(this.src) as any);\n doc = await task.promise;\n }\n if (!doc) return false;\n const win = window.open('', '_blank', 'noopener,noreferrer');\n if (!win) return false;\n win.document.write('<!doctype html><html><head><meta charset=\"utf-8\"><title>Print</title><style>@page{size:auto;margin:0} html,body{margin:0;padding:0} .page{page-break-after:always;}</style></head><body></body></html>');\n win.document.close();\n\n for (let i = 1; i <= doc.numPages; i++) {\n const page = await doc.getPage(i);\n const vp = page.getViewport({ scale: this.PRINT_SCALE });\n const canvas = document.createElement('canvas');\n canvas.width = Math.floor(vp.width);\n canvas.height = Math.floor(vp.height);\n const ctx = canvas.getContext('2d')!;\n await page.render({ canvas, canvasContext: ctx, viewport: vp }).promise;\n const img = win.document.createElement('img');\n img.className = 'page';\n img.style.width = '100%';\n img.style.display = 'block';\n img.src = canvas.toDataURL('image/png');\n win.document.body.appendChild(img);\n }\n setTimeout(() => { try { win.focus(); win.print(); } catch {} }, 300);\n win.onafterprint = () => { try { win.close(); } catch {} };\n setTimeout(() => { try { win.close(); } catch {} }, 60000);\n return true;\n } catch {\n return false;\n }\n }\n\n private async createBlobFromSrc(): Promise<Blob | null> {\n if (!this.src) return null;\n if (this.src instanceof Blob) return this.src;\n if (this.src instanceof Uint8Array) {\n const ab = new ArrayBuffer(this.src.byteLength);\n new Uint8Array(ab).set(this.src);\n return new Blob([ab], { type: 'application/pdf' });\n }\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (!href || typeof fetch === 'undefined') return null;\n try {\n const res = await fetch(href, { mode: 'cors' });\n if (!res.ok) return null;\n const blob = await res.blob();\n return blob.type ? blob : new Blob([await res.arrayBuffer()], { type: 'application/pdf' });\n } catch {\n return null;\n }\n }\n\n private deriveFilename(): string {\n if (typeof this.src === 'string') {\n try { const u = new URL(this.src, window.location.origin); return this.basename(u.pathname) || 'document.pdf'; } catch { return 'document.pdf'; }\n }\n if (this.src instanceof URL) {\n return this.basename(this.src.pathname) || 'document.pdf';\n }\n return 'document.pdf';\n }\n\n private basename(path: string): string {\n const last = path.split('/').filter(Boolean).pop() || '';\n return last.endsWith('.pdf') ? last : (last ? last + '.pdf' : 'document.pdf');\n }\n\n private normalizePdfSource(src: string | URL | Uint8Array | Blob): string | URL | Uint8Array | Blob {\n if (typeof src === 'string') {\n try {\n return new URL(src, typeof window !== 'undefined' ? window.location?.href : undefined);\n } catch {\n return src;\n }\n }\n return src;\n }\n}\n","import { APP_INITIALIZER, InjectionToken, Provider, PLATFORM_ID, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport * as pdfjsLib from 'pdfjs-dist';\n\nexport type GenusPdfWorkerConfig = {\n /** Try ESM module worker first (best); falls back to workerSrc if creation fails. */\n tryModuleWorker?: boolean;\n /** Absolute URL the app serves the worker from. Default: /assets/pdf.worker.min.mjs */\n workerSrc?: string;\n};\n\nexport const GENUS_PDF_WORKER_CONFIG = new InjectionToken<GenusPdfWorkerConfig>('GENUS_PDF_WORKER_CONFIG');\n\nfunction initPdfWorkerFactory(cfg: GenusPdfWorkerConfig, platformId: object) {\n return () => {\n if (!isPlatformBrowser(platformId)) return;\n\n const defaults: Required<Pick<GenusPdfWorkerConfig, 'tryModuleWorker' | 'workerSrc'>> = {\n tryModuleWorker: true,\n workerSrc: '/assets/pdf.worker.min.mjs',\n };\n const merged = { ...defaults, ...cfg };\n\n // 1) Try an ESM module worker (most robust across modern browsers)\n try {\n if (merged.tryModuleWorker && 'Worker' in window) {\n const worker = new Worker(\n new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url),\n { type: 'module' }\n );\n (pdfjsLib as any).GlobalWorkerOptions.workerPort = worker;\n return;\n }\n } catch {\n // fall back below\n }\n\n // 2) Fallback: classic worker path served by the app\n (pdfjsLib as any).GlobalWorkerOptions.workerSrc = merged.workerSrc;\n };\n}\n\nexport function provideGenusPdfViewer(cfg: GenusPdfWorkerConfig = {}): Provider[] {\n return [\n { provide: GENUS_PDF_WORKER_CONFIG, useValue: cfg },\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => initPdfWorkerFactory(inject(GENUS_PDF_WORKER_CONFIG), inject(PLATFORM_ID)),\n },\n ];\n}\n","/*\n * Public API Surface of genus-pdf-viewer\n */\n\nexport * from './lib/genus-pdf-viewer';\nexport { GenusPdfViewerComponent } from './lib/genus-pdf-viewer';\nexport * from './lib/pdfjs-worker.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MA0Ea,uBAAuB,CAAA;AACzB,IAAA,GAAG;IACH,IAAI,GAAG,CAAC;IACR,IAAI,GAAG,GAAG;IACV,OAAO,GAAG,CAAC;IACX,OAAO,GAAG,IAAI;IACd,GAAG,GAAmC,OAAO;IAC7C,gBAAgB,GAAG,IAAI;IACvB,UAAU,GAAG,IAAI;IACjB,WAAW,GAAG,IAAI;IAClB,aAAa,GAAG,IAAI;IACpB,eAAe,GAAG,GAAG;IACrB,kBAAkB,GAAG,GAAG;AAEO,IAAA,MAAM;AACD,IAAA,WAAW;AACjB,IAAA,KAAK;AAE5C,IAAA,GAAG;AACK,IAAA,WAAW;AAEnB,IAAA,OAAO,GAAG,MAAM,CAAC,CAAC,mDAAC;AACnB,IAAA,OAAO,GAAG,MAAM,CAAC,CAAC,mDAAC;AACnB,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,qDAAC;AACzB,IAAA,MAAM,GAAG,MAAM,CAAC,KAAK,kDAAC;AACtB,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,mDAAC;AACvB,IAAA,KAAK,GAAG,MAAM,CAAgB,IAAI,iDAAC;IAClB,WAAW,GAAG,CAAC;IACxB,SAAS,GAAG,CAAQ;IACpB,eAAe,GAAG,CAAC;IACnB,gBAAgB,GAAG,KAAK;AACxB,IAAA,iBAAiB,GAAG,IAAI,GAAG,EAAO;IAClC,QAAQ,GAAG,CAAQ;IACnB,UAAU,GAA8E,IAAI;AAC5F,IAAA,cAAc,GAAG,IAAI,GAAG,EAAkD;IAC1E,aAAa,GAAG,CA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AW,CAAC,CAAC;AAC7F,SAAA;KACF;AACH;;ACnDA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"genus-pdf-viewer.mjs","sources":["../../../projects/genus-pdf-viewer/src/lib/genus-pdf-viewer.ts","../../../projects/genus-pdf-viewer/src/lib/pdfjs-worker.provider.ts","../../../projects/genus-pdf-viewer/src/public-api.ts","../../../projects/genus-pdf-viewer/src/genus-pdf-viewer.ts"],"sourcesContent":["import { Component, Input, ViewChild, ElementRef, OnChanges, SimpleChanges, effect, signal } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport * as pdfjsLib from 'pdfjs-dist';\nimport type {\n DocumentInitParameters,\n PDFDocumentLoadingTask,\n PDFDocumentProxy,\n PDFPageProxy,\n} from 'pdfjs-dist/types/src/display/api';\n\n@Component({\n selector: 'genus-pdf-viewer',\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"genus-pdf-shell\">\n <ng-content select=\"[toolbar]\"></ng-content>\n\n <div class=\"genus-pdf-toolbar\" *ngIf=\"showToolbar\">\n <button type=\"button\" title=\"Zoom out\" aria-label=\"Zoom out\" (click)=\"zoomOut()\">−</button>\n <span class=\"pct\">{{ (zoomSig() * 100) | number:'1.0-0' }}%</span>\n <button type=\"button\" title=\"Zoom in\" aria-label=\"Zoom in\" (click)=\"zoomIn()\">+</button>\n <button type=\"button\" *ngIf=\"isZoomed()\" title=\"Reset zoom to 100%\" aria-label=\"Reset zoom to 100%\" (click)=\"resetZoom()\">100%</button>\n <span class=\"spacer\"></span>\n <button type=\"button\" title=\"Previous page\" aria-label=\"Previous page\" (click)=\"prevPage()\" [disabled]=\"pageSig() <= 1\">⟨</button>\n <span>{{ pageSig() }} / {{ doc ? doc.numPages : 0 }}</span>\n <button type=\"button\" title=\"Next page\" aria-label=\"Next page\" (click)=\"nextPage()\" [disabled]=\"doc ? pageSig() >= doc.numPages : true\">⟩</button>\n <span class=\"spacer\"></span>\n <button type=\"button\" class=\"download-btn\" title=\"Download\" aria-label=\"Download\" (click)=\"download()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M12 3v10m0 0 4-4m-4 4-4-4M5 15v3a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-3\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n <span>Download</span>\n </button>\n </div>\n\n <div class=\"genus-pdf-stage\" #singleStage [style.display]=\"continuous ? 'none' : 'flex'\" [class.can-pan]=\"canPan()\" [class.is-panning]=\"isPanning()\" (pointerdown)=\"onPointerDown($event, singleStage)\" (wheel)=\"onWheel($event, singleStage)\" (scroll)=\"onScroll($event)\">\n <div class=\"genus-pdf-overlay\" *ngIf=\"loading()\"><div class=\"spinner\" aria-label=\"Loading\"></div></div>\n <div class=\"genus-pdf-overlay error\" *ngIf=\"error()\">\n <div style=\"display:flex;flex-direction:column;gap:8px;align-items:center;\">\n <span>{{ error() }}</span>\n <button type=\"button\" (click)=\"retryLoad()\">Retry</button>\n </div>\n </div>\n <canvas #canvas></canvas>\n </div>\n\n <div class=\"genus-pdf-stage genus-pdf-stage--continuous\" #stage [style.display]=\"continuous ? 'block' : 'none'\" [class.can-pan]=\"canPan()\" [class.is-panning]=\"isPanning()\" (pointerdown)=\"onPointerDown($event, stage)\" (wheel)=\"onWheel($event, stage)\" (scroll)=\"onScroll($event)\">\n <div class=\"genus-pdf-overlay\" *ngIf=\"loading()\"><div class=\"spinner\" aria-label=\"Loading\"></div></div>\n <div class=\"genus-pdf-overlay error\" *ngIf=\"error()\">\n <div style=\"display:flex;flex-direction:column;gap:8px;align-items:center;\">\n <span>{{ error() }}</span>\n <button type=\"button\" (click)=\"retryLoad()\">Retry</button>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [`\n .genus-pdf-shell { display:flex; flex-direction:column; gap:8px; width:100%; height:100%; background:#f3f4f6; }\n .genus-pdf-toolbar { position:sticky; top:0; z-index:2; display:flex; align-items:center; gap:8px; padding:6px 8px; border:1px solid #e5e7eb; border-radius:8px; background:#ffffffd9; backdrop-filter:saturate(1.2) blur(6px); box-shadow:0 1px 2px rgba(0,0,0,0.06); }\n .genus-pdf-toolbar .pct { min-width: 48px; text-align:center; font-variant-numeric: tabular-nums; color:#111827; }\n .genus-pdf-toolbar button { appearance:none; border:1px solid #e5e7eb; background:#fff; padding:6px 10px; border-radius:6px; cursor:pointer; color:#111827; font-size:14px; line-height:1; font-weight:500; min-width:32px; user-select:none; display:inline-flex; align-items:center; gap:6px; }\n .genus-pdf-toolbar button.download-btn { background:#2563eb; border-color:#2563eb; color:#fff; }\n .genus-pdf-toolbar button.download-btn:hover { background:#1d4ed8; border-color:#1d4ed8; }\n .genus-pdf-toolbar button:disabled { opacity:0.5; cursor:not-allowed; }\n .genus-pdf-toolbar .spacer { flex:1; }\n .genus-pdf-stage { position:relative; flex:1; overflow:auto; display:flex; align-items:flex-start; justify-content:center; background:#fafafa; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; overscroll-behavior-y: contain; }\n .genus-pdf-stage.can-pan { cursor: grab; touch-action: none; }\n .genus-pdf-stage.is-panning { cursor: grabbing; }\n .genus-pdf-stage--continuous { display:block; align-items:unset; justify-content:unset; padding:8px; scroll-behavior:smooth; }\n .genus-pdf-stage--continuous .pdf-page { margin:0 auto 12px auto; background:white; box-shadow:0 1px 2px rgba(0,0,0,0.08); }\n canvas { display:block; max-width:100%; height:auto; }\n .genus-pdf-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(255,255,255,0.7); z-index:1; }\n .genus-pdf-overlay.error { background:transparent; }\n .spinner { width:28px; height:28px; border-radius:50%; border:3px solid #e5e7eb; border-top-color:#111827; animation:spin 1s linear infinite; }\n @keyframes spin { from { transform: rotate(0) } to { transform: rotate(360deg) } }\n `]\n})\nexport class GenusPdfViewerComponent implements OnChanges {\n @Input() src!: string | URL | Uint8Array | Blob;\n @Input() page = 1;\n @Input() zoom = 1.0;\n @Input() maxZoom = 4;\n @Input() minZoom = 0.25;\n @Input() fit: 'width'|'height'|'page'|'none' = 'width';\n @Input() disableTextLayer = true;\n @Input() continuous = true;\n @Input() showToolbar = true;\n @Input() zoomAnimation = true;\n @Input() zoomAnimationMs = 180;\n @Input() gestureAnimationMs = 120;\n @Input() loadTimeoutMs = 45000;\n @Input() withCredentials = false;\n @Input() httpHeaders?: Record<string, string>;\n\n @ViewChild('canvas', { static: false }) canvas!: ElementRef<HTMLCanvasElement>;\n @ViewChild('singleStage', { static: false }) singleStage!: ElementRef<HTMLDivElement>;\n @ViewChild('stage', { static: false }) stage!: ElementRef<HTMLDivElement>;\n\n doc?: PDFDocumentProxy;\n private currentPage?: PDFPageProxy;\n\n pageSig = signal(1);\n zoomSig = signal(1);\n isPanning = signal(false);\n canPan = signal(false);\n loading = signal(false);\n error = signal<string | null>(null);\n private readonly PRINT_SCALE = 2;\n private scrollRaf = 0 as any;\n private renderLockCount = 0;\n private zoomAnimInFlight = false;\n private activeRenderTasks = new Set<any>();\n private wheelRaf = 0 as any;\n private pinchState: { id1: number; id2: number; startDist: number; startZoom: number } | null = null;\n private activePointers = new Map<number, { x: number; y: number; type: string }>();\n private renderVersion = 0;\n private previewActive = false;\n private reRenderQueued = false;\n private pendingAnchor: { page: number; ratio: number } | undefined;\n private lastZoomClient: { x: number; y: number } | null = null;\n private readonly WHEEL_STEP = 0.02;\n private readonly PINCH_SENSITIVITY = 0.5;\n private wheelCommitTimer = 0 as any;\n private lastLoadError: unknown = null;\n \n\n constructor() {\n effect(() => {\n // Only react to zoom changes here; page changes in continuous mode should NOT trigger a re-render\n this.zoomSig();\n if (this.renderLockCount > 0 || this.previewActive) return;\n this.safeRender();\n });\n }\n\n async ngOnChanges(changes: SimpleChanges) {\n if (changes['page']) this.pageSig.set(this.page);\n if (changes['zoom']) this.zoomSig.set(this.zoom);\n\n const srcChanged = !!changes['src'];\n const layoutChanged = !!(changes['fit'] || changes['minZoom'] || changes['maxZoom']);\n\n if (!this.src) return;\n\n if (srcChanged) {\n await this.loadDocument();\n\n if (this.doc) {\n const pages = this.doc.numPages;\n if (this.pageSig() < 1) this.pageSig.set(1);\n if (this.pageSig() > pages) this.pageSig.set(pages);\n await this.render();\n }\n return;\n }\n\n if (layoutChanged) {\n if (this.continuous) {\n const container = this.stage?.nativeElement;\n const anchor = container ? this.captureScrollAnchor(container) || undefined : undefined;\n await this.renderAllPages(anchor);\n } else {\n await this.render();\n }\n return;\n }\n\n if (!this.continuous && changes['page']) {\n await this.render();\n }\n }\n\n async safeRender() {\n try { await this.render(); } catch (_) {}\n }\n\n private async loadDocument() {\n this.loading.set(true);\n this.error.set(null);\n this.lastLoadError = null;\n if (this.doc) {\n try { await this.doc.destroy(); } catch {}\n this.doc = undefined;\n }\n try {\n this.doc = await this.loadDocumentWithFallbacks(this.src);\n if (!this.doc) this.error.set(this.buildLoadErrorMessage());\n } catch {\n this.doc = undefined;\n this.error.set(this.buildLoadErrorMessage());\n } finally {\n this.loading.set(false);\n }\n }\n\n private async loadDocumentWithFallbacks(src: string | URL | Uint8Array | Blob): Promise<PDFDocumentProxy | undefined> {\n const workerCandidates = this.getWorkerSrcCandidates();\n const baseTimeout = this.getEffectiveLoadTimeoutMs();\n const primary = this.createPrimaryParams(src);\n if (primary && workerCandidates.length) {\n for (let i = 0; i < workerCandidates.length; i++) {\n this.applyWorkerSrc(workerCandidates[i]);\n const timeoutMs = i === 0 ? baseTimeout : Math.min(baseTimeout, 12000);\n const doc = await this.tryLoadDocument(primary, timeoutMs);\n if (doc) return doc;\n }\n } else if (primary) {\n const doc = await this.tryLoadDocument(primary, baseTimeout);\n if (doc) return doc;\n }\n\n const bytes = await this.toPdfBytes(src);\n if (!bytes) return undefined;\n\n const byteParams: DocumentInitParameters = {\n data: bytes,\n disableRange: true,\n disableStream: true,\n disableAutoFetch: true,\n stopAtErrors: true,\n };\n if (workerCandidates.length) {\n for (let i = 0; i < workerCandidates.length; i++) {\n this.applyWorkerSrc(workerCandidates[i]);\n const timeoutMs = i === 0 ? baseTimeout : Math.min(baseTimeout, 12000);\n const doc = await this.tryLoadDocument(byteParams, timeoutMs);\n if (doc) return doc;\n }\n return undefined;\n }\n return this.tryLoadDocument(byteParams, baseTimeout);\n }\n\n private createPrimaryParams(src: string | URL | Uint8Array | Blob): DocumentInitParameters | null {\n if (typeof src === 'string') {\n return {\n url: src,\n withCredentials: this.withCredentials,\n httpHeaders: this.httpHeaders,\n stopAtErrors: true,\n };\n }\n if (src instanceof URL) {\n return {\n url: src.toString(),\n withCredentials: this.withCredentials,\n httpHeaders: this.httpHeaders,\n stopAtErrors: true,\n };\n }\n if (src instanceof Uint8Array) {\n const copy = new Uint8Array(src.byteLength);\n copy.set(src);\n return {\n data: copy,\n disableRange: true,\n disableStream: true,\n disableAutoFetch: true,\n stopAtErrors: true,\n };\n }\n return null;\n }\n\n private async tryLoadDocument(params: DocumentInitParameters, timeoutMs: number): Promise<PDFDocumentProxy | undefined> {\n const task = pdfjsLib.getDocument(params as any) as PDFDocumentLoadingTask;\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n if (timeoutMs <= 0) {\n return await task.promise;\n }\n const timeoutPromise = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error('PDF load timeout')), timeoutMs);\n });\n return await Promise.race([task.promise, timeoutPromise]);\n } catch (e) {\n this.lastLoadError = e;\n try { await task.destroy(); } catch {}\n return undefined;\n } finally {\n if (timer) clearTimeout(timer);\n }\n }\n\n private getEffectiveLoadTimeoutMs(): number {\n if (!Number.isFinite(this.loadTimeoutMs)) return 45000;\n if (this.loadTimeoutMs <= 0) return 0;\n return Math.max(5000, this.loadTimeoutMs);\n }\n\n private resolveBundledWorkerSrc(): string | null {\n try {\n return new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();\n } catch {\n return null;\n }\n }\n\n private getWorkerSrcCandidates(): string[] {\n const options = (pdfjsLib as any).GlobalWorkerOptions || {};\n const current = typeof options.workerSrc === 'string' ? options.workerSrc : '';\n const bundled = this.resolveBundledWorkerSrc() || '';\n const asset = '/assets/pdf.worker.min.mjs';\n const candidates = [bundled, current, asset].filter((v) => !!v);\n return Array.from(new Set(candidates));\n }\n\n private applyWorkerSrc(workerSrc: string): void {\n const options = (pdfjsLib as any).GlobalWorkerOptions || {};\n options.workerPort = null;\n options.workerSrc = workerSrc;\n }\n\n private buildLoadErrorMessage(): string {\n const raw = this.extractErrorText(this.lastLoadError).trim();\n const lower = raw.toLowerCase();\n if (lower.includes('worker')) {\n return 'PDF worker failed to load. Run ng add genus-pdf-viewer (or copy pdf.worker.min.mjs to /assets) and retry.';\n }\n if (lower.includes('cors') || lower.includes('network') || lower.includes('fetch')) {\n return 'PDF request failed. Check file URL, network, and CORS policy, then retry.';\n }\n if (lower.includes('password')) {\n return 'This PDF appears to be password protected.';\n }\n return 'Failed to load PDF. Check URL/CORS and worker setup, then retry.';\n }\n\n private extractErrorText(error: unknown): string {\n if (!error) return '';\n if (typeof error === 'string') return error;\n if (typeof error === 'object') {\n const maybeMessage = (error as { message?: unknown }).message;\n if (typeof maybeMessage === 'string') return maybeMessage;\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n }\n return String(error);\n }\n\n private async toPdfBytes(src: string | URL | Uint8Array | Blob): Promise<Uint8Array | null> {\n if (src instanceof Uint8Array) {\n const copy = new Uint8Array(src.byteLength);\n copy.set(src);\n return copy;\n }\n if (src instanceof Blob) {\n try {\n return new Uint8Array(await src.arrayBuffer());\n } catch {\n return null;\n }\n }\n const href = typeof src === 'string' ? src : src.toString();\n if (typeof fetch === 'undefined') return null;\n try {\n const res = await fetch(href, {\n mode: 'cors',\n headers: this.httpHeaders,\n credentials: this.withCredentials ? 'include' : 'same-origin',\n });\n if (!res.ok) return null;\n return new Uint8Array(await res.arrayBuffer());\n } catch {\n return null;\n }\n }\n\n async render() {\n if (!this.doc) return;\n const version = ++this.renderVersion;\n if (this.continuous) {\n await this.renderAllPages();\n return;\n }\n\n const pageNum = this.pageSig();\n const pdfPage = await this.doc.getPage(pageNum);\n this.currentPage = pdfPage;\n\n const canvas = this.canvas?.nativeElement;\n if (!canvas) return;\n const ctx = canvas.getContext('2d')!;\n\n const baseViewport = pdfPage.getViewport({ scale: 1 });\n const parent = canvas.parentElement!;\n const anchor = this.captureScrollAnchor(parent) || undefined;\n const pW = parent.clientWidth, pH = parent.clientHeight || baseViewport.height;\n\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (pW - 16) / baseViewport.width;\n if (this.fit === 'height') baseScale = (pH - 16) / baseViewport.height;\n if (this.fit === 'page') baseScale = Math.min((pW - 16) / baseViewport.width, (pH - 16) / baseViewport.height);\n\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n this.canPan.set(finalScale > baseScale + 0.001);\n const viewport = pdfPage.getViewport({ scale: finalScale });\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = pdfPage.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n if (anchor) this.restoreScrollAnchor(parent, anchor);\n }\n\n private async renderAllPages(anchorOverride?: { page: number; ratio: number }) {\n if (!this.doc) return;\n const stageEl = this.stage?.nativeElement;\n if (!stageEl) return;\n const version = ++this.renderVersion;\n const anchor = anchorOverride ?? this.captureScrollAnchor(stageEl);\n const total = this.doc.numPages;\n const parentRect = stageEl.getBoundingClientRect();\n const parentWidth = parentRect.width || stageEl.clientWidth || 800;\n let computedCanPan = false;\n const existing = Array.from(stageEl.querySelectorAll<HTMLElement>('.pdf-page'));\n const isInitialBuild = existing.length !== total;\n this.renderLockCount++;\n try {\n if (isInitialBuild) {\n stageEl.innerHTML = '';\n const contentEl = document.createElement('div');\n contentEl.className = 'pdf-content';\n stageEl.appendChild(contentEl);\n for (let i = 1; i <= total; i++) {\n const page = await this.doc.getPage(i);\n const baseViewport = page.getViewport({ scale: 1 });\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (parentWidth - 16) / baseViewport.width;\n if (this.fit === 'page') baseScale = (parentWidth - 16) / baseViewport.width;\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n if (i === 1) computedCanPan = finalScale > baseScale + 0.001;\n const viewport = page.getViewport({ scale: finalScale });\n\n const wrapper = document.createElement('div');\n wrapper.className = 'pdf-page';\n wrapper.setAttribute('data-page', String(i));\n wrapper.style.width = Math.floor(viewport.width) + 'px';\n wrapper.style.height = Math.floor(viewport.height) + 'px';\n wrapper.style.margin = '0 auto 12px auto';\n\n const canvas = document.createElement('canvas');\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const ctx = canvas.getContext('2d')!;\n\n wrapper.appendChild(canvas);\n contentEl.appendChild(wrapper);\n\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = page.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n }\n } else {\n let contentEl = stageEl.querySelector<HTMLElement>('.pdf-content');\n if (!contentEl) {\n contentEl = document.createElement('div');\n contentEl.className = 'pdf-content';\n const pages = Array.from(stageEl.querySelectorAll<HTMLElement>('.pdf-page'));\n for (const el of pages) contentEl.appendChild(el);\n stageEl.appendChild(contentEl);\n }\n for (let i = 1; i <= total; i++) {\n const page = await this.doc.getPage(i);\n const baseViewport = page.getViewport({ scale: 1 });\n let baseScale = 1;\n if (this.fit === 'width') baseScale = (parentWidth - 16) / baseViewport.width;\n if (this.fit === 'page') baseScale = (parentWidth - 16) / baseViewport.width;\n const minScale = baseScale * this.minZoom;\n const maxScale = baseScale * this.maxZoom;\n const finalScale = Math.max(minScale, Math.min(maxScale, baseScale * this.zoomSig()));\n if (i === 1) computedCanPan = finalScale > baseScale + 0.001;\n const viewport = page.getViewport({ scale: finalScale });\n\n const wrapper = existing[i - 1];\n const canvas = wrapper.querySelector('canvas') as HTMLCanvasElement;\n wrapper.style.width = Math.floor(viewport.width) + 'px';\n wrapper.style.height = Math.floor(viewport.height) + 'px';\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) ? window.devicePixelRatio : 1;\n canvas.style.width = Math.floor(viewport.width) + 'px';\n canvas.style.height = Math.floor(viewport.height) + 'px';\n canvas.width = Math.floor(viewport.width * dpr);\n canvas.height = Math.floor(viewport.height * dpr);\n const ctx = canvas.getContext('2d')!;\n const renderCtx: any = { canvasContext: ctx, viewport };\n if (dpr !== 1) renderCtx.transform = [dpr, 0, 0, dpr, 0, 0];\n const task = page.render(renderCtx);\n await task.promise;\n if (this.renderVersion !== version) return;\n }\n }\n this.canPan.set(computedCanPan);\n if (anchor) this.restoreScrollAnchor(stageEl, anchor);\n } finally {\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n }\n }\n\n async goTo(page: number) {\n if (!this.doc) return;\n const p = Math.max(1, Math.min(this.doc.numPages, page));\n this.pageSig.set(p);\n if (this.continuous) {\n const stageEl = this.stage?.nativeElement;\n const el = stageEl?.querySelector(`[data-page=\"${p}\"]`) as HTMLElement | null;\n el?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n } else {\n await this.render();\n }\n }\n async zoomIn(step = 0.1) { await this.applyZoomDelta(step); }\n async zoomOut(step = 0.1) { await this.applyZoomDelta(-step); }\n\n private clampZoom(z: number): number {\n return Math.max(this.minZoom, Math.min(this.maxZoom, z));\n }\n\n private cancelPreviewIfAny(container?: HTMLElement): void {\n if (!this.previewActive || !container) return;\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n try {\n target.style.transform = '';\n target.style.willChange = '';\n target.style.transition = '';\n } catch {}\n this.previewActive = false;\n this.lastZoomClient = null;\n }\n\n private async applyZoomDelta(delta: number): Promise<void> {\n const oldZoom = this.zoomSig();\n const newZoom = this.clampZoom(oldZoom + delta);\n if (Math.abs(newZoom - oldZoom) < 0.0001) return;\n\n const container = this.continuous ? this.stage?.nativeElement : this.singleStage?.nativeElement;\n // If a preview transform is active (from pinch/wheel), clear it before capturing anchor or animating\n this.cancelPreviewIfAny(container);\n const anchor = container ? this.captureScrollAnchor(container) || undefined : undefined;\n const ratio = newZoom / oldZoom;\n\n if (this.zoomAnimation && container && !this.zoomAnimInFlight) {\n this.zoomAnimInFlight = true;\n this.renderLockCount++;\n // Update UI value immediately\n this.zoomSig.set(newZoom);\n try {\n await this.runZoomAnimation(container, ratio);\n } finally {\n // Release the render lock before triggering the actual re-render\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n await this.safeReRenderWithCancellation(anchor);\n this.zoomAnimInFlight = false;\n }\n } else {\n this.zoomSig.set(newZoom);\n await this.safeReRenderWithCancellation(anchor);\n }\n }\n\n private async runZoomAnimation(container: HTMLElement, ratio: number): Promise<void> {\n if (Math.abs(ratio - 1) < 0.0001) return;\n const { target, originX, originY } = this.getZoomAnimTarget(container);\n return new Promise<void>((resolve) => {\n try {\n const onDone = () => {\n cleanup();\n resolve();\n };\n const cleanup = () => {\n target.removeEventListener('transitionend', onEnd as any);\n target.style.transition = '';\n target.style.transform = '';\n target.style.transformOrigin = '';\n target.style.willChange = '';\n };\n const onEnd = () => onDone();\n target.style.willChange = 'transform';\n target.style.transformOrigin = `${Math.max(0, originX)}px ${Math.max(0, originY)}px`;\n target.style.transition = 'none';\n target.style.transform = 'scale(1)';\n requestAnimationFrame(() => {\n target.addEventListener('transitionend', onEnd as any, { once: true } as any);\n target.style.transition = `transform ${this.zoomAnimationMs}ms cubic-bezier(0.2,0,0,1)`;\n target.style.transform = `scale(${ratio})`;\n setTimeout(onDone, this.zoomAnimationMs + 60);\n });\n } catch {\n resolve();\n }\n });\n }\n\n private getZoomAnimTarget(container: HTMLElement): { target: HTMLElement; originX: number; originY: number } {\n const isContinuous = this.continuous;\n let target: HTMLElement | null = null;\n if (isContinuous) {\n target = container.querySelector<HTMLElement>('.pdf-content');\n if (!target) target = container; // fallback\n } else {\n target = container.querySelector<HTMLElement>('canvas');\n if (!target) target = container; // fallback\n }\n const rectLeft = target.offsetLeft;\n const rectTop = target.offsetTop;\n // Prefer last gesture point (pinch center or wheel pointer) if available\n const client = this.lastZoomClient;\n const originX = client ? (container.scrollLeft + client.x - rectLeft) : (container.scrollLeft + container.clientWidth / 2 - rectLeft);\n const originY = client ? (container.scrollTop + client.y - rectTop) : (container.scrollTop + container.clientHeight / 2 - rectTop);\n return { target, originX, originY };\n }\n\n onScroll(evt: Event) {\n const container = evt.target as HTMLElement;\n // debounce via rAF\n if (this.scrollRaf) cancelAnimationFrame(this.scrollRaf);\n this.scrollRaf = requestAnimationFrame(() => {\n if (!this.doc || !this.continuous) return;\n const pages = Array.from(container.querySelectorAll<HTMLElement>('.pdf-page'));\n if (!pages.length) return;\n const centerY = container.scrollTop + container.clientHeight / 2;\n let current = this.pageSig();\n for (const el of pages) {\n const top = el.offsetTop;\n const bottom = top + el.offsetHeight;\n if (centerY >= top && centerY <= bottom) {\n const p = parseInt(el.getAttribute('data-page') || '1', 10);\n current = p;\n break;\n }\n }\n if (current !== this.pageSig()) this.pageSig.set(current);\n });\n }\n\n async nextPage() { await this.goTo(this.pageSig() + 1); }\n async prevPage() { await this.goTo(this.pageSig() - 1); }\n\n isZoomed(): boolean {\n return Math.abs(this.zoomSig() - 1) > 0.0001;\n }\n\n async resetZoom() {\n // Reset to exactly 1.0 (100%)\n const delta = 1 - this.zoomSig();\n await this.applyZoomDelta(delta);\n }\n\n async retryLoad() {\n await this.loadDocument();\n if (this.doc) {\n const pages = this.doc.numPages;\n if (this.pageSig() < 1) this.pageSig.set(1);\n if (this.pageSig() > pages) this.pageSig.set(pages);\n await this.render();\n }\n }\n\n onPointerDown(evt: PointerEvent, containerEl: HTMLElement) {\n // Pinch-to-zoom (two pointers)\n if (evt.pointerType === 'touch') {\n this.activePointers.set(evt.pointerId, { x: evt.clientX, y: evt.clientY, type: evt.pointerType });\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerType === 'touch') this.activePointers.set(e.pointerId, { x: e.clientX, y: e.clientY, type: e.pointerType });\n const touches = Array.from(this.activePointers.entries()).map(([id, p]) => ({ pointerId: id, clientX: p.x, clientY: p.y }))\n .slice(0, 2);\n if (touches.length === 2) {\n const [a, b] = touches;\n const dist = Math.hypot(a.clientX - b.clientX, a.clientY - b.clientY);\n if (!this.pinchState) {\n this.pinchState = { id1: a.pointerId, id2: b.pointerId, startDist: Math.max(1, dist), startZoom: this.zoomSig() };\n const rect = containerEl.getBoundingClientRect();\n this.lastZoomClient = { x: ((a.clientX + b.clientX) / 2) - rect.left, y: ((a.clientY + b.clientY) / 2) - rect.top };\n }\n const scale = dist / Math.max(1, this.pinchState.startDist);\n const adjusted = 1 + (scale - 1) * this.PINCH_SENSITIVITY;\n const desiredAdj = this.clampZoom(this.pinchState.startZoom * adjusted);\n this.previewZoom(containerEl, desiredAdj);\n e.preventDefault();\n return;\n }\n // When pinch ends (not exactly two touches), commit render if we were previewing\n if (this.pinchState) {\n const final = this.zoomSig();\n this.commitPreviewZoom(containerEl, final);\n this.pinchState = null;\n this.lastZoomClient = null;\n }\n };\n const onPointerEnd = (e: PointerEvent) => {\n this.activePointers.delete(e.pointerId);\n const touches = Array.from(this.activePointers.values());\n if (touches.length !== 2 && this.pinchState) {\n const final = this.zoomSig();\n this.commitPreviewZoom(containerEl, final);\n this.pinchState = null;\n this.lastZoomClient = null;\n }\n cleanup();\n };\n const cleanup = () => {\n containerEl.removeEventListener('pointermove', onPointerMove);\n containerEl.removeEventListener('pointerup', onPointerEnd);\n containerEl.removeEventListener('pointercancel', onPointerEnd);\n this.activePointers.clear();\n };\n containerEl.addEventListener('pointermove', onPointerMove);\n containerEl.addEventListener('pointerup', onPointerEnd);\n containerEl.addEventListener('pointercancel', onPointerEnd);\n return;\n }\n\n // Mouse pan when canPan\n if (!this.canPan()) return;\n this.isPanning.set(true);\n const startX = evt.clientX;\n const startY = evt.clientY;\n const startLeft = containerEl.scrollLeft;\n const startTop = containerEl.scrollTop;\n containerEl.style.scrollBehavior = 'auto';\n containerEl.setPointerCapture?.(evt.pointerId);\n const move = (e: PointerEvent) => {\n const dx = e.clientX - startX;\n const dy = e.clientY - startY;\n containerEl.scrollLeft = startLeft - dx;\n containerEl.scrollTop = startTop - dy;\n e.preventDefault();\n };\n const end = (e: PointerEvent) => {\n this.isPanning.set(false);\n containerEl.releasePointerCapture?.(evt.pointerId);\n containerEl.removeEventListener('pointermove', move);\n containerEl.removeEventListener('pointerup', end);\n containerEl.removeEventListener('pointercancel', end);\n containerEl.style.scrollBehavior = 'smooth';\n };\n containerEl.addEventListener('pointermove', move);\n containerEl.addEventListener('pointerup', end);\n containerEl.addEventListener('pointercancel', end);\n }\n\n private getActiveTouches(containerEl: HTMLElement): PointerEvent[] {\n // We capture pointer events only on this element; maintain list by querying PointerEvent.getCoalescedEvents not available broadly.\n // Instead, rely on touches reported in native events; browsers will deliver move events for all active pointers targeting the element.\n // Here we cannot query directly; so we return an empty array and use move handler state. For simplicity, we derive from event stream only.\n // This helper remains for future extension; current logic passes actual events to compute pinch.\n return [] as any;\n }\n\n onWheel(evt: WheelEvent, containerEl: HTMLElement) {\n const isCtrlZoom = evt.ctrlKey || evt.metaKey;\n if (!isCtrlZoom) return;\n evt.preventDefault();\n const rect = containerEl.getBoundingClientRect();\n // Record gesture point relative to container\n this.lastZoomClient = { x: evt.clientX - rect.left, y: evt.clientY - rect.top };\n if (this.wheelRaf) cancelAnimationFrame(this.wheelRaf);\n if (this.wheelCommitTimer) clearTimeout(this.wheelCommitTimer);\n const delta = -evt.deltaY;\n const step = delta > 0 ? this.WHEEL_STEP : -this.WHEEL_STEP;\n const desired = this.clampZoom(this.zoomSig() + step);\n this.previewZoom(containerEl, desired);\n this.wheelRaf = requestAnimationFrame(() => {\n this.wheelCommitTimer = setTimeout(() => {\n this.commitPreviewZoom(containerEl, this.zoomSig());\n this.lastZoomClient = null;\n }, this.gestureAnimationMs + 20);\n });\n }\n\n private previewZoom(container: HTMLElement, newZoom: number) {\n const oldZoom = this.zoomSig();\n if (Math.abs(newZoom - oldZoom) < 0.0001) return;\n const ratio = newZoom / oldZoom;\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n const origin = this.getZoomAnimTarget(container);\n target.style.willChange = 'transform';\n target.style.transformOrigin = `${Math.max(0, origin.originX)}px ${Math.max(0, origin.originY)}px`;\n target.style.transition = `transform ${this.gestureAnimationMs}ms cubic-bezier(0.2,0,0,1)`;\n target.style.transform = `scale(${ratio})`;\n this.zoomSig.set(newZoom);\n this.previewActive = true;\n }\n\n private async commitPreviewZoom(container: HTMLElement, expectedZoom: number) {\n // Clear transform and re-render once; cancel any in-flight render tasks\n const target = this.continuous ? (container.querySelector('.pdf-content') as HTMLElement || container) : (container.querySelector('canvas') as HTMLElement || container);\n target.style.transform = '';\n target.style.willChange = '';\n target.style.transition = '';\n const anchor = this.captureScrollAnchor(container) || undefined;\n if (this.previewActive) {\n await this.safeReRenderWithCancellation(anchor);\n this.previewActive = false;\n }\n }\n\n private async safeReRenderWithCancellation(anchor?: { page: number; ratio: number }) {\n // If a render is in progress, queue once with the most recent anchor\n if (this.renderLockCount > 0) {\n this.reRenderQueued = true;\n if (anchor) this.pendingAnchor = anchor;\n return;\n }\n try {\n this.renderLockCount++;\n if (this.continuous) {\n await this.renderAllPages(anchor);\n } else {\n await this.render();\n }\n } finally {\n this.renderLockCount = Math.max(0, this.renderLockCount - 1);\n if (this.renderLockCount === 0 && this.reRenderQueued) {\n const nextAnchor = this.pendingAnchor;\n this.reRenderQueued = false;\n this.pendingAnchor = undefined;\n await this.safeReRenderWithCancellation(nextAnchor);\n }\n }\n }\n\n private captureScrollAnchor(container: HTMLElement, client?: { x: number; y: number } | null): { page: number; ratio: number } | null {\n try {\n const pages = Array.from(container.querySelectorAll<HTMLElement>('.pdf-page'));\n const centerY = container.scrollTop + container.clientHeight / 2;\n if (pages.length > 0) {\n let pageEl = pages.find(el => (el.offsetTop <= centerY && (el.offsetTop + el.offsetHeight) >= centerY))\n || pages.find(el => (el.offsetTop + el.offsetHeight) > (container.scrollTop + 1))\n || pages[0];\n const page = parseInt(pageEl.getAttribute('data-page') || '1', 10);\n const height = Math.max(1, pageEl.offsetHeight);\n const ratio = Math.max(0, Math.min(1, (centerY - pageEl.offsetTop) / height));\n return { page, ratio };\n }\n // Fallback: single-canvas mode\n const canvas = container.querySelector('canvas');\n if (!canvas) return null;\n const height = Math.max(1, (canvas as HTMLElement).offsetHeight);\n const ratio = Math.max(0, Math.min(1, (centerY - (canvas as HTMLElement).offsetTop) / height));\n return { page: 1, ratio };\n } catch {\n return null;\n }\n }\n\n private restoreScrollAnchor(container: HTMLElement, anchor: { page: number; ratio: number }): void {\n try {\n let el = container.querySelector<HTMLElement>(`[data-page=\"${anchor.page}\"]`);\n if (!el) el = container.querySelector<HTMLElement>('canvas');\n if (!el) return;\n const prevBehavior = container.style.scrollBehavior;\n container.style.scrollBehavior = 'auto';\n const height = Math.max(1, el.offsetHeight);\n const desired = el.offsetTop + anchor.ratio * height - container.clientHeight / 2;\n const maxScroll = Math.max(0, container.scrollHeight - container.clientHeight);\n container.scrollTop = Math.max(0, Math.min(maxScroll, desired));\n container.style.scrollBehavior = prevBehavior;\n } catch {}\n }\n\n async download() {\n const filename = this.deriveFilename();\n const link = document.createElement('a');\n const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && (navigator as any).maxTouchPoints > 1);\n let popup: Window | null = null;\n if (isIOS) {\n // Open a tab synchronously to stay within user gesture\n try { popup = window.open('', '_blank', 'noopener,noreferrer'); } catch { popup = null; }\n }\n\n const blob = await this.createBlobFromSrc();\n if (blob) {\n const url = URL.createObjectURL(blob);\n if (isIOS) {\n if (popup) {\n try { popup.location.href = url; } catch { /* ignore */ }\n // Revoke later to allow the view to load fully\n setTimeout(() => URL.revokeObjectURL(url), 30000);\n } else {\n const a = document.createElement('a');\n a.href = url;\n a.target = '_blank';\n a.rel = 'noopener';\n document.body.appendChild(a);\n a.click();\n a.remove();\n setTimeout(() => URL.revokeObjectURL(url), 30000);\n }\n } else {\n link.href = url;\n link.download = filename;\n link.rel = 'noopener';\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n link.remove();\n URL.revokeObjectURL(url);\n }\n return;\n }\n\n // Fallback: cross-origin without CORS\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (!href) return;\n if (isIOS) {\n if (popup) {\n try { popup.location.href = href; } catch { /* ignore */ }\n } else {\n const a = document.createElement('a');\n a.href = href;\n a.target = '_blank';\n a.rel = 'noopener';\n document.body.appendChild(a);\n a.click();\n a.remove();\n }\n } else {\n link.href = href;\n link.target = '_blank';\n link.rel = 'noopener';\n link.download = filename; // browsers may ignore for cross-origin\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n link.remove();\n }\n }\n\n async print() {\n // Robust, plugin-free printing by rendering pages to images\n const ok = await this.printViaImages();\n if (ok) return;\n // Fallbacks\n const blob = await this.createBlobFromSrc();\n if (blob) {\n const url = URL.createObjectURL(blob);\n const win = window.open('', '_blank', 'noopener,noreferrer');\n if (win) {\n win.document.write('<!doctype html><html><head><title>Print</title><meta charset=\"utf-8\"><style>html,body{height:100%;margin:0}@page{size:auto;margin:0} iframe{border:0;width:100%;height:100%}</style></head><body><iframe src=\"' + url + '\"></iframe></body></html>');\n win.document.close();\n setTimeout(() => { try { win.focus(); win.print(); } catch {} }, 800);\n win.onafterprint = () => { try { win.close(); } catch {} URL.revokeObjectURL(url); };\n } else {\n const iframe = document.createElement('iframe');\n iframe.style.position = 'fixed'; iframe.style.right = '0'; iframe.style.bottom = '0';\n iframe.style.width = '0'; iframe.style.height = '0'; iframe.style.border = '0';\n iframe.src = url; document.body.appendChild(iframe);\n iframe.onload = () => { try { setTimeout(() => iframe.contentWindow?.print(), 800); } catch {} setTimeout(() => { URL.revokeObjectURL(url); iframe.remove(); }, 3000); };\n }\n return;\n }\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (href) window.open(href, '_blank');\n }\n\n private async printViaImages(): Promise<boolean> {\n try {\n let doc = this.doc;\n if (!doc) {\n doc = await this.loadDocumentWithFallbacks(this.src);\n }\n if (!doc) return false;\n const win = window.open('', '_blank', 'noopener,noreferrer');\n if (!win) return false;\n win.document.write('<!doctype html><html><head><meta charset=\"utf-8\"><title>Print</title><style>@page{size:auto;margin:0} html,body{margin:0;padding:0} .page{page-break-after:always;}</style></head><body></body></html>');\n win.document.close();\n\n for (let i = 1; i <= doc.numPages; i++) {\n const page = await doc.getPage(i);\n const vp = page.getViewport({ scale: this.PRINT_SCALE });\n const canvas = document.createElement('canvas');\n canvas.width = Math.floor(vp.width);\n canvas.height = Math.floor(vp.height);\n const ctx = canvas.getContext('2d')!;\n await page.render({ canvas, canvasContext: ctx, viewport: vp }).promise;\n const img = win.document.createElement('img');\n img.className = 'page';\n img.style.width = '100%';\n img.style.display = 'block';\n img.src = canvas.toDataURL('image/png');\n win.document.body.appendChild(img);\n }\n setTimeout(() => { try { win.focus(); win.print(); } catch {} }, 300);\n win.onafterprint = () => { try { win.close(); } catch {} };\n setTimeout(() => { try { win.close(); } catch {} }, 60000);\n return true;\n } catch {\n return false;\n }\n }\n\n private async createBlobFromSrc(): Promise<Blob | null> {\n if (!this.src) return null;\n if (this.src instanceof Blob) return this.src;\n if (this.src instanceof Uint8Array) {\n const ab = new ArrayBuffer(this.src.byteLength);\n new Uint8Array(ab).set(this.src);\n return new Blob([ab], { type: 'application/pdf' });\n }\n const href = typeof this.src === 'string' ? this.src : (this.src instanceof URL ? this.src.toString() : '');\n if (!href || typeof fetch === 'undefined') return null;\n try {\n const res = await fetch(href, {\n mode: 'cors',\n headers: this.httpHeaders,\n credentials: this.withCredentials ? 'include' : 'same-origin',\n });\n if (!res.ok) return null;\n const blob = await res.blob();\n return blob.type ? blob : new Blob([await res.arrayBuffer()], { type: 'application/pdf' });\n } catch {\n return null;\n }\n }\n\n private deriveFilename(): string {\n if (typeof this.src === 'string') {\n try { const u = new URL(this.src, window.location.origin); return this.basename(u.pathname) || 'document.pdf'; } catch { return 'document.pdf'; }\n }\n if (this.src instanceof URL) {\n return this.basename(this.src.pathname) || 'document.pdf';\n }\n return 'document.pdf';\n }\n\n private basename(path: string): string {\n const last = path.split('/').filter(Boolean).pop() || '';\n return last.endsWith('.pdf') ? last : (last ? last + '.pdf' : 'document.pdf');\n }\n}\n","import { APP_INITIALIZER, InjectionToken, Provider, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport * as pdfjsLib from 'pdfjs-dist';\n\nexport type GenusPdfWorkerConfig = {\n /** Try ESM module worker first (best); falls back to workerSrc if creation fails. */\n tryModuleWorker?: boolean;\n /** Absolute URL the app serves the worker from. Default: /assets/pdf.worker.min.mjs */\n workerSrc?: string;\n};\n\nexport const GENUS_PDF_WORKER_CONFIG = new InjectionToken<GenusPdfWorkerConfig>('GENUS_PDF_WORKER_CONFIG');\n\nfunction resolveBundledWorkerUrl(): string | null {\n try {\n return new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();\n } catch {\n return null;\n }\n}\n\nfunction initPdfWorkerFactory(cfg: GenusPdfWorkerConfig, platformId: object) {\n return async () => {\n if (!isPlatformBrowser(platformId)) return;\n\n const defaults: Required<Pick<GenusPdfWorkerConfig, 'tryModuleWorker'>> = {\n tryModuleWorker: true,\n };\n const merged = { ...defaults, ...cfg };\n\n const globalOptions = (pdfjsLib as any).GlobalWorkerOptions;\n globalOptions.workerPort = null;\n if (typeof merged.workerSrc === 'string' && merged.workerSrc.length > 0) {\n globalOptions.workerSrc = merged.workerSrc;\n return;\n }\n if (!merged.tryModuleWorker) {\n globalOptions.workerSrc = '/assets/pdf.worker.min.mjs';\n return;\n }\n const bundledWorkerUrl = resolveBundledWorkerUrl();\n globalOptions.workerSrc = bundledWorkerUrl || '/assets/pdf.worker.min.mjs';\n };\n}\n\nexport function provideGenusPdfViewer(cfg: GenusPdfWorkerConfig = {}): Provider[] {\n return [\n { provide: GENUS_PDF_WORKER_CONFIG, useValue: cfg },\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: initPdfWorkerFactory,\n deps: [GENUS_PDF_WORKER_CONFIG, PLATFORM_ID],\n },\n ];\n}\n","/*\n * Public API Surface of genus-pdf-viewer\n */\n\nexport * from './lib/genus-pdf-viewer';\nexport { GenusPdfViewerComponent } from './lib/genus-pdf-viewer';\nexport * from './lib/pdfjs-worker.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MA+Ea,uBAAuB,CAAA;AACzB,IAAA,GAAG;IACH,IAAI,GAAG,CAAC;IACR,IAAI,GAAG,GAAG;IACV,OAAO,GAAG,CAAC;IACX,OAAO,GAAG,IAAI;IACd,GAAG,GAAmC,OAAO;IAC7C,gBAAgB,GAAG,IAAI;IACvB,UAAU,GAAG,IAAI;IACjB,WAAW,GAAG,IAAI;IAClB,aAAa,GAAG,IAAI;IACpB,eAAe,GAAG,GAAG;IACrB,kBAAkB,GAAG,GAAG;IACxB,aAAa,GAAG,KAAK;IACrB,eAAe,GAAG,KAAK;AACvB,IAAA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G,IAAI;AAC/B,QAAA,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AACvE,YAAA,aAAa,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;YAC1C;QACF;AACA,QAAA,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;AAC3B,YAAA,aAAa,CAAC,SAAS,GAAG,4BAA4B;YACtD;QACF;AACA,QAAA,MAAM,gBAAgB,GAAG,uBAAuB,EAAE;AAClD,QAAA,aAAa,CAAC,SAAS,GAAG,gBAAgB,IAAI,4BAA4B;AAC5E,IAAA,CAAC;AACH;AAEM,SAAU,qBAAqB,CAAC,GAAA,GAA4B,EAAE,EAAA;IAClE,OAAO;AACL,QAAA,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,GAAG,EAAE;AACnD,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,UAAU,EAAE,oBAAoB;AAChC,YAAA,IAAI,EAAE,CAAC,uBAAuB,EAAE,WAAW,CAAC;AAC7C,SAAA;KACF;AACH;;ACvDA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ declare class GenusPdfViewerComponent implements OnChanges {
|
|
|
15
15
|
zoomAnimation: boolean;
|
|
16
16
|
zoomAnimationMs: number;
|
|
17
17
|
gestureAnimationMs: number;
|
|
18
|
+
loadTimeoutMs: number;
|
|
19
|
+
withCredentials: boolean;
|
|
20
|
+
httpHeaders?: Record<string, string>;
|
|
18
21
|
canvas: ElementRef<HTMLCanvasElement>;
|
|
19
22
|
singleStage: ElementRef<HTMLDivElement>;
|
|
20
23
|
stage: ElementRef<HTMLDivElement>;
|
|
@@ -42,10 +45,21 @@ declare class GenusPdfViewerComponent implements OnChanges {
|
|
|
42
45
|
private readonly WHEEL_STEP;
|
|
43
46
|
private readonly PINCH_SENSITIVITY;
|
|
44
47
|
private wheelCommitTimer;
|
|
48
|
+
private lastLoadError;
|
|
45
49
|
constructor();
|
|
46
50
|
ngOnChanges(changes: SimpleChanges): Promise<void>;
|
|
47
51
|
safeRender(): Promise<void>;
|
|
48
52
|
private loadDocument;
|
|
53
|
+
private loadDocumentWithFallbacks;
|
|
54
|
+
private createPrimaryParams;
|
|
55
|
+
private tryLoadDocument;
|
|
56
|
+
private getEffectiveLoadTimeoutMs;
|
|
57
|
+
private resolveBundledWorkerSrc;
|
|
58
|
+
private getWorkerSrcCandidates;
|
|
59
|
+
private applyWorkerSrc;
|
|
60
|
+
private buildLoadErrorMessage;
|
|
61
|
+
private extractErrorText;
|
|
62
|
+
private toPdfBytes;
|
|
49
63
|
render(): Promise<void>;
|
|
50
64
|
private renderAllPages;
|
|
51
65
|
goTo(page: number): Promise<void>;
|
|
@@ -76,9 +90,8 @@ declare class GenusPdfViewerComponent implements OnChanges {
|
|
|
76
90
|
private createBlobFromSrc;
|
|
77
91
|
private deriveFilename;
|
|
78
92
|
private basename;
|
|
79
|
-
private normalizePdfSource;
|
|
80
93
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GenusPdfViewerComponent, never>;
|
|
81
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<GenusPdfViewerComponent, "genus-pdf-viewer", never, { "src": { "alias": "src"; "required": false; }; "page": { "alias": "page"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "fit": { "alias": "fit"; "required": false; }; "disableTextLayer": { "alias": "disableTextLayer"; "required": false; }; "continuous": { "alias": "continuous"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "zoomAnimation": { "alias": "zoomAnimation"; "required": false; }; "zoomAnimationMs": { "alias": "zoomAnimationMs"; "required": false; }; "gestureAnimationMs": { "alias": "gestureAnimationMs"; "required": false; }; }, {}, never, ["[toolbar]"], true, never>;
|
|
94
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<GenusPdfViewerComponent, "genus-pdf-viewer", never, { "src": { "alias": "src"; "required": false; }; "page": { "alias": "page"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "fit": { "alias": "fit"; "required": false; }; "disableTextLayer": { "alias": "disableTextLayer"; "required": false; }; "continuous": { "alias": "continuous"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "zoomAnimation": { "alias": "zoomAnimation"; "required": false; }; "zoomAnimationMs": { "alias": "zoomAnimationMs"; "required": false; }; "gestureAnimationMs": { "alias": "gestureAnimationMs"; "required": false; }; "loadTimeoutMs": { "alias": "loadTimeoutMs"; "required": false; }; "withCredentials": { "alias": "withCredentials"; "required": false; }; "httpHeaders": { "alias": "httpHeaders"; "required": false; }; }, {}, never, ["[toolbar]"], true, never>;
|
|
82
95
|
}
|
|
83
96
|
|
|
84
97
|
type GenusPdfWorkerConfig = {
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add genus-pdf-viewer provider and worker asset",
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { SchematicsException } = require('@angular-devkit/schematics');
|
|
4
|
+
|
|
5
|
+
const PROVIDER_CALL = 'provideGenusPdfViewer()';
|
|
6
|
+
|
|
7
|
+
function toPosix(filePath) {
|
|
8
|
+
return filePath.replace(/\\/g, '/');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function readWorkspace(tree) {
|
|
12
|
+
const workspacePath = '/angular.json';
|
|
13
|
+
if (!tree.exists(workspacePath)) {
|
|
14
|
+
throw new SchematicsException('angular.json not found in workspace root');
|
|
15
|
+
}
|
|
16
|
+
const raw = tree.read(workspacePath);
|
|
17
|
+
if (!raw) {
|
|
18
|
+
throw new SchematicsException('Unable to read angular.json');
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(raw.toString('utf-8'));
|
|
22
|
+
} catch {
|
|
23
|
+
throw new SchematicsException('Invalid angular.json');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function resolveProjectName(workspace, requestedProject) {
|
|
28
|
+
if (requestedProject) return requestedProject;
|
|
29
|
+
if (workspace.defaultProject) return workspace.defaultProject;
|
|
30
|
+
const projectNames = Object.keys(workspace.projects || {});
|
|
31
|
+
const appProject = projectNames.find((name) => workspace.projects[name]?.projectType === 'application');
|
|
32
|
+
return appProject || projectNames[0];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function resolveAssetsDir(project) {
|
|
36
|
+
const assets = project?.architect?.build?.options?.assets;
|
|
37
|
+
if (Array.isArray(assets)) {
|
|
38
|
+
for (const asset of assets) {
|
|
39
|
+
if (typeof asset === 'string') {
|
|
40
|
+
const normalized = toPosix(asset);
|
|
41
|
+
if (normalized.endsWith('/assets')) return normalized;
|
|
42
|
+
} else if (asset && typeof asset.input === 'string') {
|
|
43
|
+
const input = toPosix(asset.input).replace(/\/$/, '');
|
|
44
|
+
if (input.endsWith('/assets')) return input;
|
|
45
|
+
return `${input}/assets`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (typeof project?.sourceRoot === 'string') {
|
|
50
|
+
return `${toPosix(project.sourceRoot).replace(/\/$/, '')}/assets`;
|
|
51
|
+
}
|
|
52
|
+
if (typeof project?.root === 'string') {
|
|
53
|
+
return `${toPosix(project.root).replace(/\/$/, '')}/src/assets`;
|
|
54
|
+
}
|
|
55
|
+
return 'src/assets';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function findAppConfigPath(tree, project) {
|
|
59
|
+
const sourceRoot = toPosix(project?.sourceRoot || '');
|
|
60
|
+
const candidates = [
|
|
61
|
+
`${sourceRoot}/app/app.config.ts`,
|
|
62
|
+
`${sourceRoot}/app.config.ts`,
|
|
63
|
+
];
|
|
64
|
+
return candidates.find((candidate) => candidate && tree.exists(candidate)) || null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function detectImportPath(content, requestedImportPath) {
|
|
68
|
+
if (content.includes(`from '@genus/pdf-viewer'`) || content.includes(`from "@genus/pdf-viewer"`)) {
|
|
69
|
+
return '@genus/pdf-viewer';
|
|
70
|
+
}
|
|
71
|
+
if (content.includes(`from 'genus-pdf-viewer'`) || content.includes(`from "genus-pdf-viewer"`)) {
|
|
72
|
+
return 'genus-pdf-viewer';
|
|
73
|
+
}
|
|
74
|
+
return requestedImportPath || 'genus-pdf-viewer';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function ensureImport(content, importPath) {
|
|
78
|
+
if (content.includes('provideGenusPdfViewer')) return content;
|
|
79
|
+
const importLine = `import { provideGenusPdfViewer } from '${importPath}';`;
|
|
80
|
+
const lines = content.split('\n');
|
|
81
|
+
let lastImportIndex = -1;
|
|
82
|
+
for (let i = 0; i < lines.length; i++) {
|
|
83
|
+
if (lines[i].trim().startsWith('import ')) {
|
|
84
|
+
lastImportIndex = i;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
lines.splice(lastImportIndex + 1, 0, importLine);
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function ensureProvider(content) {
|
|
92
|
+
if (content.includes(PROVIDER_CALL)) return { content, changed: false };
|
|
93
|
+
if (!/providers\s*:\s*\[/.test(content)) return { content, changed: false };
|
|
94
|
+
return {
|
|
95
|
+
content: content.replace(/providers\s*:\s*\[/, (match) => `${match}\n ${PROVIDER_CALL},`),
|
|
96
|
+
changed: true,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function patchAppConfig(tree, appConfigPath, importPath, context) {
|
|
101
|
+
const raw = tree.read(appConfigPath);
|
|
102
|
+
if (!raw) return false;
|
|
103
|
+
let content = raw.toString('utf-8');
|
|
104
|
+
const detectedImportPath = detectImportPath(content, importPath);
|
|
105
|
+
content = ensureImport(content, detectedImportPath);
|
|
106
|
+
const result = ensureProvider(content);
|
|
107
|
+
if (!result.changed) {
|
|
108
|
+
if (!result.content.includes(PROVIDER_CALL)) {
|
|
109
|
+
context.logger.warn(`Could not inject ${PROVIDER_CALL} into ${appConfigPath}. Add it manually.`);
|
|
110
|
+
}
|
|
111
|
+
if (result.content !== raw.toString('utf-8')) {
|
|
112
|
+
tree.overwrite(appConfigPath, result.content);
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
tree.overwrite(appConfigPath, result.content);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function copyWorkerFile(tree, targetDir, overwriteWorker, context) {
|
|
121
|
+
const sourcePath = path.join(process.cwd(), 'node_modules', 'pdfjs-dist', 'build', 'pdf.worker.min.mjs');
|
|
122
|
+
if (!fs.existsSync(sourcePath)) {
|
|
123
|
+
context.logger.warn('pdfjs worker not found in node_modules. Install dependencies and copy manually.');
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const targetPath = `${targetDir.replace(/\/$/, '')}/pdf.worker.min.mjs`;
|
|
127
|
+
const contents = fs.readFileSync(sourcePath, 'utf-8');
|
|
128
|
+
if (tree.exists(targetPath)) {
|
|
129
|
+
if (overwriteWorker) {
|
|
130
|
+
tree.overwrite(targetPath, contents);
|
|
131
|
+
context.logger.info(`Updated ${targetPath}`);
|
|
132
|
+
} else {
|
|
133
|
+
context.logger.info(`Kept existing ${targetPath}`);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
tree.create(targetPath, contents);
|
|
138
|
+
context.logger.info(`Created ${targetPath}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function ngAdd(options = {}) {
|
|
142
|
+
return (tree, context) => {
|
|
143
|
+
const workspace = readWorkspace(tree);
|
|
144
|
+
const projectName = resolveProjectName(workspace, options.project);
|
|
145
|
+
if (!projectName || !workspace.projects?.[projectName]) {
|
|
146
|
+
throw new SchematicsException('Could not resolve target Angular project');
|
|
147
|
+
}
|
|
148
|
+
const project = workspace.projects[projectName];
|
|
149
|
+
const appConfigPath = findAppConfigPath(tree, project);
|
|
150
|
+
if (appConfigPath) {
|
|
151
|
+
patchAppConfig(tree, appConfigPath, options.importPath, context);
|
|
152
|
+
} else {
|
|
153
|
+
context.logger.warn('app.config.ts not found. Add provideGenusPdfViewer() manually.');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (!options.skipWorkerCopy) {
|
|
157
|
+
const assetsDir = resolveAssetsDir(project);
|
|
158
|
+
copyWorkerFile(tree, assetsDir, options.overwriteWorker, context);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
context.logger.info('genus-pdf-viewer ng-add completed.');
|
|
162
|
+
return tree;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
module.exports = {
|
|
167
|
+
ngAdd,
|
|
168
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "GenusPdfViewerNgAddSchema",
|
|
4
|
+
"title": "Genus PDF Viewer ng-add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Angular project to configure"
|
|
10
|
+
},
|
|
11
|
+
"importPath": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Import path used for provideGenusPdfViewer",
|
|
14
|
+
"default": "genus-pdf-viewer"
|
|
15
|
+
},
|
|
16
|
+
"skipWorkerCopy": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Skip copying pdf.worker.min.mjs into assets/public",
|
|
19
|
+
"default": false
|
|
20
|
+
},
|
|
21
|
+
"overwriteWorker": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Overwrite existing worker file",
|
|
24
|
+
"default": false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|