@progress/kendo-angular-pdfviewer 18.4.1-develop.2 → 18.5.0-develop.10
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.
@@ -10,7 +10,7 @@ export const packageMetadata = {
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
11
11
|
productCode: 'KENDOUIANGULAR',
|
12
12
|
productCodes: ['KENDOUIANGULAR'],
|
13
|
-
publishDate:
|
14
|
-
version: '18.
|
13
|
+
publishDate: 1744092635,
|
14
|
+
version: '18.5.0-develop.10',
|
15
15
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning',
|
16
16
|
};
|
@@ -6,8 +6,8 @@ import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, In
|
|
6
6
|
import { validatePackage } from '@progress/kendo-licensing';
|
7
7
|
import { packageMetadata } from './package-metadata';
|
8
8
|
import { INITIAL_ZOOM_LEVEL, zoomOptionsData, zoomToFitOptions } from './util';
|
9
|
-
import {
|
10
|
-
import { hasObservers, shouldShowValidationUI, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
|
9
|
+
import { PdfViewer, removeChildren, } from '@progress/kendo-pdfviewer-common';
|
10
|
+
import { EventsOutsideAngularDirective, hasObservers, shouldShowValidationUI, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
|
11
11
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
12
12
|
import { PDFViewerDownloadEvent } from './models/events';
|
13
13
|
import { saveAs } from '@progress/kendo-file-saver';
|
@@ -29,6 +29,7 @@ export class PDFViewerComponent {
|
|
29
29
|
renderer;
|
30
30
|
localizationService;
|
31
31
|
cdr;
|
32
|
+
host;
|
32
33
|
hostClass = true;
|
33
34
|
direction;
|
34
35
|
/**
|
@@ -95,7 +96,7 @@ export class PDFViewerComponent {
|
|
95
96
|
this.setZoomLevel(value);
|
96
97
|
}
|
97
98
|
else {
|
98
|
-
this._zoom =
|
99
|
+
this._zoom = INITIAL_ZOOM_LEVEL;
|
99
100
|
this._fitType = zoomToFitOptions[value];
|
100
101
|
}
|
101
102
|
this._zoomToFit = typeof value !== 'number';
|
@@ -118,6 +119,18 @@ export class PDFViewerComponent {
|
|
118
119
|
* @default 4
|
119
120
|
*/
|
120
121
|
maxZoom = 4;
|
122
|
+
/**
|
123
|
+
* Determines whether all PDF document pages will be initially loaded or new pages will be loaded on demand when needed.
|
124
|
+
*
|
125
|
+
* @default false
|
126
|
+
*/
|
127
|
+
loadOnDemand = false;
|
128
|
+
/**
|
129
|
+
* The number of pages that will be loaded on demand.
|
130
|
+
*
|
131
|
+
* @default 1
|
132
|
+
*/
|
133
|
+
loadOnDemandPageSize = 1;
|
121
134
|
/**
|
122
135
|
* The event fired when a PDF document is successfully loaded in the `PDFViewer` component.
|
123
136
|
*/
|
@@ -182,8 +195,8 @@ export class PDFViewerComponent {
|
|
182
195
|
* @hidden
|
183
196
|
*/
|
184
197
|
set enabledSelection(value) {
|
185
|
-
if (this.
|
186
|
-
value ? this.
|
198
|
+
if (this.pdfViewerWidget) {
|
199
|
+
value ? this.pdfViewerWidget.documentScroller.disablePanEventsTracking() : this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
|
187
200
|
}
|
188
201
|
this._enabledSelection = value;
|
189
202
|
}
|
@@ -205,14 +218,14 @@ export class PDFViewerComponent {
|
|
205
218
|
_zoom = INITIAL_ZOOM_LEVEL;
|
206
219
|
_fitType;
|
207
220
|
_zoomToFit = false;
|
208
|
-
pdfScroller;
|
209
|
-
searchService;
|
210
221
|
subs = new Subscription();
|
211
|
-
|
222
|
+
emitLoad = true;
|
223
|
+
constructor(ngZone, renderer, localizationService, cdr, host) {
|
212
224
|
this.ngZone = ngZone;
|
213
225
|
this.renderer = renderer;
|
214
226
|
this.localizationService = localizationService;
|
215
227
|
this.cdr = cdr;
|
228
|
+
this.host = host;
|
216
229
|
const isValid = validatePackage(packageMetadata);
|
217
230
|
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
218
231
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
@@ -221,21 +234,9 @@ export class PDFViewerComponent {
|
|
221
234
|
ngOnInit() {
|
222
235
|
this.subs.add(this.localizationService.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
|
223
236
|
}
|
224
|
-
ngAfterViewInit() {
|
225
|
-
const pagesContainer = this.pagesContainer.nativeElement.parentNode;
|
226
|
-
this.ngZone.runOutsideAngular(() => this.subs.add(this.renderer.listen(pagesContainer, 'scroll', this.scrollListener)));
|
227
|
-
}
|
228
237
|
ngOnDestroy() {
|
229
238
|
this.subs.unsubscribe();
|
230
|
-
|
231
|
-
if (this.pdfScroller) {
|
232
|
-
this.pdfScroller.destroy();
|
233
|
-
this.pdfScroller = null;
|
234
|
-
}
|
235
|
-
if (this.searchService) {
|
236
|
-
this.searchService.destroy();
|
237
|
-
this.searchService = null;
|
238
|
-
}
|
239
|
+
this.pdfViewerWidget?.destroy();
|
239
240
|
this.pdfContext = null;
|
240
241
|
}
|
241
242
|
ngOnChanges(changes) {
|
@@ -256,7 +257,7 @@ export class PDFViewerComponent {
|
|
256
257
|
* ([see example](slug:tools_pdfviewer#programmatically-scrolling-the-pdfviewer)).
|
257
258
|
*/
|
258
259
|
scrollToPage(page) {
|
259
|
-
scrollToPage(
|
260
|
+
this.pdfViewerWidget?.scrollToPage({ pageNumber: page });
|
260
261
|
}
|
261
262
|
/**
|
262
263
|
* @hidden
|
@@ -268,18 +269,13 @@ export class PDFViewerComponent {
|
|
268
269
|
* @hidden
|
269
270
|
*/
|
270
271
|
onFileSelectError(e) {
|
271
|
-
|
272
|
+
this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
|
272
273
|
}
|
273
274
|
/**
|
274
275
|
* @hidden
|
275
276
|
*/
|
276
277
|
onPageChange(e) {
|
277
|
-
this.scrollToPage(e.skip);
|
278
|
-
hasObservers(this.pageChange) && this.pageChange.emit({
|
279
|
-
previousPage: this.skip + 1,
|
280
|
-
currentPage: e.skip + 1
|
281
|
-
});
|
282
|
-
this.skip = e.skip;
|
278
|
+
this.scrollToPage(e.skip + 1);
|
283
279
|
}
|
284
280
|
/**
|
285
281
|
* @hidden
|
@@ -289,52 +285,49 @@ export class PDFViewerComponent {
|
|
289
285
|
.then((data) => new Blob([data], { type: 'application/pdf' }))
|
290
286
|
.then((blob) => {
|
291
287
|
const downloadEvent = new PDFViewerDownloadEvent(blob, this.saveFileName, this.saveOptions, this.pdfContext);
|
292
|
-
this.
|
288
|
+
this.zoneAwareEmitter('download', downloadEvent);
|
293
289
|
if (!downloadEvent.isDefaultPrevented()) {
|
294
290
|
saveAs(blob, this.saveFileName, this.saveOptions);
|
295
291
|
}
|
296
292
|
})
|
297
293
|
.catch((reason) => {
|
298
|
-
|
299
|
-
this.ngZone.run(() => this.error.emit({
|
300
|
-
error: reason,
|
301
|
-
context: this.pdfContext
|
302
|
-
}));
|
303
|
-
}
|
294
|
+
this.zoneAwareEmitter('error', { error: reason, context: this.pdfContext });
|
304
295
|
}));
|
305
296
|
}
|
297
|
+
/**
|
298
|
+
* @hidden
|
299
|
+
*/
|
300
|
+
stopPropagation = (e) => {
|
301
|
+
if (e.ctrlKey || e.metaKey) {
|
302
|
+
e.preventDefault();
|
303
|
+
}
|
304
|
+
};
|
306
305
|
/**
|
307
306
|
* @hidden
|
308
307
|
*/
|
309
308
|
onZoomIn() {
|
310
|
-
const newZoom = Math.min(this.
|
311
|
-
if (newZoom !== this.
|
312
|
-
|
313
|
-
this.
|
314
|
-
|
315
|
-
|
316
|
-
});
|
317
|
-
}
|
309
|
+
const newZoom = Math.min(this.zoom + this.zoomRate, this.maxZoom);
|
310
|
+
if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
|
311
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
312
|
+
previousZoomLevel: this.zoom,
|
313
|
+
currentZoomLevel: newZoom
|
314
|
+
});
|
318
315
|
this.zoom = this.pdfContext.zoom = newZoom;
|
319
316
|
this.setZoomLevel(newZoom);
|
320
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
321
317
|
}
|
322
318
|
}
|
323
319
|
/**
|
324
320
|
* @hidden
|
325
321
|
*/
|
326
322
|
onZoomOut() {
|
327
|
-
const newZoom = Math.max(this.
|
328
|
-
if (newZoom !== this.
|
329
|
-
|
330
|
-
this.
|
331
|
-
|
332
|
-
|
333
|
-
});
|
334
|
-
}
|
323
|
+
const newZoom = Math.max(this.zoom - this.zoomRate, this.minZoom);
|
324
|
+
if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
|
325
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
326
|
+
previousZoomLevel: this.zoom,
|
327
|
+
currentZoomLevel: newZoom
|
328
|
+
});
|
335
329
|
this.zoom = this.pdfContext.zoom = newZoom;
|
336
330
|
this.setZoomLevel(newZoom);
|
337
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
338
331
|
}
|
339
332
|
}
|
340
333
|
/**
|
@@ -348,55 +341,40 @@ export class PDFViewerComponent {
|
|
348
341
|
text: '100%'
|
349
342
|
};
|
350
343
|
}
|
351
|
-
let newZoom =
|
352
|
-
|
344
|
+
let newZoom = zoomLevel.type ? this.pdfViewerWidget?.calculateZoomLevel({
|
345
|
+
zoomLevel: zoomLevel.value,
|
346
|
+
zoomLevelType: zoomLevel.type,
|
347
|
+
currentZoom: this.zoom
|
348
|
+
}) : Math.min(Math.max(zoomLevel.value, this.minZoom), this.maxZoom);
|
349
|
+
newZoom = Math.floor(newZoom * 100) / 100;
|
353
350
|
const sameZoom = this.zoom === newZoom;
|
354
|
-
if (!sameZoom
|
355
|
-
this.zoomLevelChange
|
351
|
+
if (!sameZoom) {
|
352
|
+
emit && this.zoneAwareEmitter('zoomLevelChange', {
|
356
353
|
previousZoomLevel: this.zoom,
|
357
354
|
currentZoomLevel: newZoom
|
358
355
|
});
|
356
|
+
this.zoom = this.pdfContext.zoom = newZoom;
|
359
357
|
}
|
360
|
-
this.
|
361
|
-
this.setZoomLevel(newZoom);
|
362
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
358
|
+
this.setZoomLevel(newZoom, zoomLevel.type);
|
363
359
|
}
|
364
360
|
/**
|
365
361
|
* @hidden
|
366
362
|
*/
|
367
363
|
onSearch() {
|
368
364
|
this.searchActive = true;
|
369
|
-
this.ngZone.runOutsideAngular(() => {
|
370
|
-
const pagesTextLayers = Array.from(this.pagesContainer.nativeElement.querySelectorAll('.k-text-layer'));
|
371
|
-
this.searchService = new SearchService({
|
372
|
-
textContainers: pagesTextLayers || [],
|
373
|
-
highlightClass: 'k-search-highlight',
|
374
|
-
highlightMarkClass: 'k-search-highlight-mark',
|
375
|
-
charClass: 'k-text-char'
|
376
|
-
});
|
377
|
-
});
|
378
365
|
}
|
379
366
|
/**
|
380
367
|
* @hidden
|
381
368
|
*/
|
382
369
|
onPrint() {
|
383
370
|
this.loading = true;
|
384
|
-
|
385
|
-
this.loading = false;
|
386
|
-
if (hasObservers(this.error)) {
|
387
|
-
this.error.emit(e);
|
388
|
-
}
|
389
|
-
};
|
390
|
-
const onDone = () => {
|
391
|
-
this.loading = false;
|
392
|
-
};
|
393
|
-
print(this.pdfContext.pdfPages, onDone, onError);
|
371
|
+
this.pdfViewerWidget?.printFile();
|
394
372
|
}
|
395
373
|
/**
|
396
374
|
* @hidden
|
397
375
|
*/
|
398
376
|
onSearchChange(e) {
|
399
|
-
this.currentMatches = this.searchService.search({ ...e });
|
377
|
+
this.currentMatches = this.pdfViewerWidget.searchService.search({ ...e });
|
400
378
|
this.currentMatch = this.currentMatches.length ? 1 : 0;
|
401
379
|
}
|
402
380
|
/**
|
@@ -404,7 +382,7 @@ export class PDFViewerComponent {
|
|
404
382
|
*/
|
405
383
|
closeSearch(toolbar) {
|
406
384
|
this.searchActive = false;
|
407
|
-
this.searchService.destroy();
|
385
|
+
this.pdfViewerWidget.searchService.destroy();
|
408
386
|
this.currentMatches = [];
|
409
387
|
this.currentMatch = null;
|
410
388
|
toolbar.focus();
|
@@ -413,57 +391,45 @@ export class PDFViewerComponent {
|
|
413
391
|
* @hidden
|
414
392
|
*/
|
415
393
|
onNextMatch() {
|
416
|
-
goToNextSearchMatch(
|
394
|
+
this.pdfViewerWidget?.goToNextSearchMatch();
|
417
395
|
this.currentMatch = this.currentMatch + 1 > this.currentMatches.length ? 1 : this.currentMatch + 1;
|
418
396
|
}
|
419
397
|
/**
|
420
398
|
* @hidden
|
421
399
|
*/
|
422
400
|
onPreviousMatch() {
|
423
|
-
goToPreviousSearchMatch(
|
401
|
+
this.pdfViewerWidget?.goToPreviousSearchMatch();
|
424
402
|
this.currentMatch = this.currentMatch - 1 < 1 ? this.currentMatches.length : this.currentMatch - 1;
|
425
403
|
}
|
404
|
+
pdfViewerWidget;
|
426
405
|
loadPdf(dataType, data) {
|
406
|
+
this.pdfViewerWidget?.destroy();
|
427
407
|
this.loading = true;
|
408
|
+
this.emitLoad = true;
|
428
409
|
this.ngZone.runOutsideAngular(() => setTimeout(() => {
|
410
|
+
// try to destroy if new dynamic data source
|
429
411
|
removeChildren(this.pagesContainer.nativeElement);
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
pdfDoc: this.pdfContext?.pdfDoc,
|
445
|
-
zoom: this.zoom,
|
446
|
-
dom: this.pagesContainer.nativeElement,
|
447
|
-
done: (pdfPages) => {
|
448
|
-
this.pdfContext.pdfPages = pdfPages;
|
449
|
-
this.ngZone.run(() => {
|
412
|
+
const file = dataType === 'src' || dataType === 'data' ? { [dataType]: data } : { data };
|
413
|
+
this.pdfViewerWidget = new PdfViewer(this.host.nativeElement, {
|
414
|
+
loadOnDemand: this.loadOnDemand,
|
415
|
+
loadOnDemandPageSize: this.loadOnDemandPageSize,
|
416
|
+
zoomLevel: this.zoom,
|
417
|
+
scaleFactor: 1,
|
418
|
+
fileDescriptor: file,
|
419
|
+
events: {
|
420
|
+
pagesLoad: this.loadHandler,
|
421
|
+
zoomStart: () => {
|
422
|
+
this.skip = this.pdfViewerWidget.getCurrentPageIndex();
|
423
|
+
},
|
424
|
+
zoomEnd: this.zoomEndHandler,
|
425
|
+
printEnd: () => {
|
450
426
|
this.loading = false;
|
451
|
-
|
452
|
-
|
453
|
-
this.
|
454
|
-
},
|
455
|
-
error: (e) => {
|
456
|
-
if (this.pdfScroller) {
|
457
|
-
this.pdfScroller.destroy();
|
458
|
-
this.pdfScroller = null;
|
459
|
-
}
|
460
|
-
this.pdfContext = null;
|
461
|
-
if (hasObservers(this.error)) {
|
462
|
-
this.ngZone.run(() => this.error.emit({ error: e, context: this.pdfContext }));
|
463
|
-
}
|
427
|
+
},
|
428
|
+
scroll: this.scrollHandler,
|
429
|
+
error: this.errorHandler
|
464
430
|
}
|
465
431
|
});
|
466
|
-
}
|
432
|
+
}));
|
467
433
|
}
|
468
434
|
assignPageIds() {
|
469
435
|
this.pagesContainer.nativeElement.querySelectorAll('.k-page').forEach((pageElement, index) => {
|
@@ -471,13 +437,15 @@ export class PDFViewerComponent {
|
|
471
437
|
this.renderer.setAttribute(pageElement, 'id', id);
|
472
438
|
});
|
473
439
|
}
|
474
|
-
setZoomLevel(zoom) {
|
475
|
-
const option = this.zoomOptionsData.find(item => !item.type && item.value === zoom);
|
476
|
-
this.zoomLevel = option
|
440
|
+
setZoomLevel(zoom, type) {
|
441
|
+
const option = this.zoomOptionsData.find(item => (!item.type && item.value === zoom) || (item.type && item.type === type));
|
442
|
+
this.zoomLevel = structuredClone(option) ?? {
|
477
443
|
value: zoom,
|
478
444
|
displayValue: `${Math.round(zoom * 100)}%`,
|
479
445
|
text: `${Math.round(zoom * 100)}%`
|
480
446
|
};
|
447
|
+
this.pdfViewerWidget?.setState({ zoomLevel: zoom });
|
448
|
+
this.pdfViewerWidget?.reloadFile(this.pdfContext.pdfDoc);
|
481
449
|
}
|
482
450
|
verifySettings(changes) {
|
483
451
|
const sourceTypes = ['url', 'arrayBuffer', 'data', 'typedArray'];
|
@@ -492,54 +460,61 @@ export class PDFViewerComponent {
|
|
492
460
|
isSet(changes, source) {
|
493
461
|
return this[source] || changes[source]?.currentValue;
|
494
462
|
}
|
495
|
-
|
496
|
-
const
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
this.skip = nextPage;
|
463
|
+
scrollHandler = (e) => {
|
464
|
+
const currentPage = this.currentPage;
|
465
|
+
this.skip = e.pageNumber - 1;
|
466
|
+
this.cdr.markForCheck();
|
467
|
+
if (e.isPageChanged) {
|
468
|
+
this.zoneAwareEmitter('pageChange', {
|
469
|
+
previousPage: currentPage,
|
470
|
+
currentPage: e.pageNumber
|
504
471
|
});
|
505
472
|
}
|
506
473
|
};
|
507
474
|
loadHandler = (e) => {
|
475
|
+
if (!this.pdfContext) {
|
476
|
+
this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
|
477
|
+
}
|
508
478
|
if (!this._zoomToFit) {
|
509
479
|
this.ngZone.run(() => {
|
510
|
-
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
|
480
|
+
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement, zoom: e.sender.state.zoomLevel };
|
511
481
|
this.loading = false;
|
512
|
-
this.
|
482
|
+
if (this.emitLoad) {
|
483
|
+
this.zoneAwareEmitter('load', { context: this.pdfContext });
|
484
|
+
this.emitLoad = false;
|
485
|
+
}
|
513
486
|
});
|
514
487
|
}
|
515
488
|
else {
|
516
489
|
const zoomLevelOption = this.zoomOptionsData.find(item => item.type === this._fitType);
|
517
490
|
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
|
518
491
|
this.onZoomLevelChange(zoomLevelOption, false);
|
519
|
-
this.
|
492
|
+
this.pdfViewerWidget.reloadFile(this.pdfContext.pdfDoc);
|
520
493
|
}
|
521
|
-
|
522
|
-
this.pdfScroller.destroy();
|
523
|
-
}
|
524
|
-
this.pdfScroller = this.pdfScroller = new Scroller(this.pagesContainer.nativeElement.parentNode, {
|
525
|
-
filter: '.k-page',
|
526
|
-
events: {}
|
527
|
-
});
|
528
|
-
this.pdfScroller.enablePanEventsTracking();
|
494
|
+
this.cdr.markForCheck();
|
529
495
|
this.assignPageIds();
|
530
|
-
|
531
|
-
|
532
|
-
|
496
|
+
};
|
497
|
+
zoomEndHandler = (e) => {
|
498
|
+
const zoom = Math.min(Math.max(e.zoomLevel, this.minZoom), this.maxZoom);
|
499
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
500
|
+
currentZoomLevel: zoom,
|
501
|
+
previousZoomLevel: this.zoom
|
502
|
+
});
|
503
|
+
this.zoom = zoom;
|
504
|
+
this.setZoomLevel(zoom);
|
533
505
|
};
|
534
506
|
errorHandler = (e) => {
|
535
507
|
this.ngZone.run(() => this.loading = false);
|
536
508
|
this.pdfContext = null;
|
537
|
-
|
538
|
-
|
509
|
+
this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
|
510
|
+
};
|
511
|
+
zoneAwareEmitter = (eventName, eventData) => {
|
512
|
+
if (hasObservers(this[eventName])) {
|
513
|
+
this.ngZone.run(() => this[eventName].emit(eventData));
|
539
514
|
}
|
540
515
|
};
|
541
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
542
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PDFViewerComponent, isStandalone: true, selector: "kendo-pdfviewer", inputs: { tools: "tools", loaderSettings: "loaderSettings", saveFileName: "saveFileName", saveOptions: "saveOptions", url: "url", data: "data", arrayBuffer: "arrayBuffer", typedArray: "typedArray", zoom: "zoom", zoomRate: "zoomRate", minZoom: "minZoom", maxZoom: "maxZoom" }, outputs: { load: "load", error: "error", download: "download", pageChange: "pageChange", zoomLevelChange: "zoomLevelChange" }, host: { properties: { "class.k-pdf-viewer": "this.hostClass", "attr.dir": "this.direction" } }, providers: [
|
516
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
517
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PDFViewerComponent, isStandalone: true, selector: "kendo-pdfviewer", inputs: { tools: "tools", loaderSettings: "loaderSettings", saveFileName: "saveFileName", saveOptions: "saveOptions", url: "url", data: "data", arrayBuffer: "arrayBuffer", typedArray: "typedArray", zoom: "zoom", zoomRate: "zoomRate", minZoom: "minZoom", maxZoom: "maxZoom", loadOnDemand: "loadOnDemand", loadOnDemandPageSize: "loadOnDemandPageSize" }, outputs: { load: "load", error: "error", download: "download", pageChange: "pageChange", zoomLevelChange: "zoomLevelChange" }, host: { properties: { "class.k-pdf-viewer": "this.hostClass", "attr.dir": "this.direction" } }, providers: [
|
543
518
|
LocalizationService,
|
544
519
|
{
|
545
520
|
provide: L10N_PREFIX,
|
@@ -668,17 +643,15 @@ export class PDFViewerComponent {
|
|
668
643
|
(close)="closeSearch(toolbar)"></div>
|
669
644
|
<div
|
670
645
|
#pagesContainer
|
646
|
+
[kendoEventsOutsideAngular]="{
|
647
|
+
wheel: stopPropagation
|
648
|
+
}"
|
671
649
|
class="k-pdf-viewer-pages"
|
672
|
-
[
|
673
|
-
[attr.id]="pagesContainerId">
|
674
|
-
<div class="k-page">
|
675
|
-
<div class="k-text-layer"></div>
|
676
|
-
</div>
|
677
|
-
</div>
|
650
|
+
[attr.id]="pagesContainerId"></div>
|
678
651
|
</div>
|
679
652
|
|
680
653
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
681
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedPDFViewerMessagesDirective, selector: "[kendoPDFViewerLocalizedMessages]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoaderComponent, selector: "[kendoPDFViewerLoader]", inputs: ["settings"] }, { kind: "component", type: ToolbarComponent, selector: "[kendoPDFViewerToolbar]", inputs: ["zoomLevel", "calculatedComboBoxValue", "skip", "pageSize", "total", "zoomInDisabled", "zoomOutDisabled", "disabledTools", "zoomLevelChooserValue", "zoomOptionsData", "pagesContainerId", "tools"], outputs: ["fileSelect", "fileSelectStart", "fileSelectError", "download", "selectionEnabled", "panningEnabled", "pageChange", "zoomIn", "zoomOut", "zoomLevelChange", "print", "search"] }, { kind: "component", type: PDFViewerSearchComponent, selector: "[kendoPDFViewerSearch]", inputs: ["matches", "currentMatch"], outputs: ["searchChange", "prevMatch", "nextMatch", "close"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]" }] });
|
654
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedPDFViewerMessagesDirective, selector: "[kendoPDFViewerLocalizedMessages]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "component", type: LoaderComponent, selector: "[kendoPDFViewerLoader]", inputs: ["settings"] }, { kind: "component", type: ToolbarComponent, selector: "[kendoPDFViewerToolbar]", inputs: ["zoomLevel", "calculatedComboBoxValue", "skip", "pageSize", "total", "zoomInDisabled", "zoomOutDisabled", "disabledTools", "zoomLevelChooserValue", "zoomOptionsData", "pagesContainerId", "tools"], outputs: ["fileSelect", "fileSelectStart", "fileSelectError", "download", "selectionEnabled", "panningEnabled", "pageChange", "zoomIn", "zoomOut", "zoomLevelChange", "print", "search"] }, { kind: "component", type: PDFViewerSearchComponent, selector: "[kendoPDFViewerSearch]", inputs: ["matches", "currentMatch"], outputs: ["searchChange", "prevMatch", "nextMatch", "close"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]" }] });
|
682
655
|
}
|
683
656
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, decorators: [{
|
684
657
|
type: Component,
|
@@ -815,21 +788,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
815
788
|
(close)="closeSearch(toolbar)"></div>
|
816
789
|
<div
|
817
790
|
#pagesContainer
|
791
|
+
[kendoEventsOutsideAngular]="{
|
792
|
+
wheel: stopPropagation
|
793
|
+
}"
|
818
794
|
class="k-pdf-viewer-pages"
|
819
|
-
[
|
820
|
-
[attr.id]="pagesContainerId">
|
821
|
-
<div class="k-page">
|
822
|
-
<div class="k-text-layer"></div>
|
823
|
-
</div>
|
824
|
-
</div>
|
795
|
+
[attr.id]="pagesContainerId"></div>
|
825
796
|
</div>
|
826
797
|
|
827
798
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
828
799
|
`,
|
829
800
|
standalone: true,
|
830
|
-
imports: [LocalizedPDFViewerMessagesDirective, NgIf, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
|
801
|
+
imports: [LocalizedPDFViewerMessagesDirective, NgIf, EventsOutsideAngularDirective, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
|
831
802
|
}]
|
832
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
|
803
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { hostClass: [{
|
833
804
|
type: HostBinding,
|
834
805
|
args: ['class.k-pdf-viewer']
|
835
806
|
}], direction: [{
|
@@ -859,6 +830,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
859
830
|
type: Input
|
860
831
|
}], maxZoom: [{
|
861
832
|
type: Input
|
833
|
+
}], loadOnDemand: [{
|
834
|
+
type: Input
|
835
|
+
}], loadOnDemandPageSize: [{
|
836
|
+
type: Input
|
862
837
|
}], load: [{
|
863
838
|
type: Output
|
864
839
|
}], error: [{
|
package/esm2022/util.mjs
CHANGED
@@ -21,13 +21,13 @@ export const zoomOptionsData = [{
|
|
21
21
|
id: 1,
|
22
22
|
text: 'Fit to width',
|
23
23
|
type: 'FitToWidth',
|
24
|
-
displayValue: '',
|
24
|
+
displayValue: 'Fit to width',
|
25
25
|
value: 1
|
26
26
|
}, {
|
27
27
|
id: 2,
|
28
28
|
text: 'Fit to page',
|
29
29
|
type: 'FitToPage',
|
30
|
-
displayValue: '',
|
30
|
+
displayValue: 'Fit to page',
|
31
31
|
value: 1
|
32
32
|
}, {
|
33
33
|
id: 3,
|
@@ -7,8 +7,8 @@ import { Directive, Input, forwardRef, Component, Injectable, HostBinding, Event
|
|
7
7
|
import * as i1 from '@progress/kendo-angular-l10n';
|
8
8
|
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
10
|
-
import { removeChildren,
|
11
|
-
import { PreventableEvent, Keys, focusableSelector, shouldShowValidationUI, hasObservers, WatermarkOverlayComponent, ResizeBatchService } from '@progress/kendo-angular-common';
|
10
|
+
import { removeChildren, PdfViewer } from '@progress/kendo-pdfviewer-common';
|
11
|
+
import { PreventableEvent, Keys, focusableSelector, shouldShowValidationUI, hasObservers, EventsOutsideAngularDirective, WatermarkOverlayComponent, ResizeBatchService } from '@progress/kendo-angular-common';
|
12
12
|
import { saveAs } from '@progress/kendo-file-saver';
|
13
13
|
import { Subscription } from 'rxjs';
|
14
14
|
import { PagerComponent, CustomMessagesComponent } from '@progress/kendo-angular-pager';
|
@@ -228,8 +228,8 @@ const packageMetadata = {
|
|
228
228
|
productName: 'Kendo UI for Angular',
|
229
229
|
productCode: 'KENDOUIANGULAR',
|
230
230
|
productCodes: ['KENDOUIANGULAR'],
|
231
|
-
publishDate:
|
232
|
-
version: '18.
|
231
|
+
publishDate: 1744092635,
|
232
|
+
version: '18.5.0-develop.10',
|
233
233
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning',
|
234
234
|
};
|
235
235
|
|
@@ -252,13 +252,13 @@ const zoomOptionsData = [{
|
|
252
252
|
id: 1,
|
253
253
|
text: 'Fit to width',
|
254
254
|
type: 'FitToWidth',
|
255
|
-
displayValue: '',
|
255
|
+
displayValue: 'Fit to width',
|
256
256
|
value: 1
|
257
257
|
}, {
|
258
258
|
id: 2,
|
259
259
|
text: 'Fit to page',
|
260
260
|
type: 'FitToPage',
|
261
|
-
displayValue: '',
|
261
|
+
displayValue: 'Fit to page',
|
262
262
|
value: 1
|
263
263
|
}, {
|
264
264
|
id: 3,
|
@@ -1339,6 +1339,7 @@ class PDFViewerComponent {
|
|
1339
1339
|
renderer;
|
1340
1340
|
localizationService;
|
1341
1341
|
cdr;
|
1342
|
+
host;
|
1342
1343
|
hostClass = true;
|
1343
1344
|
direction;
|
1344
1345
|
/**
|
@@ -1405,7 +1406,7 @@ class PDFViewerComponent {
|
|
1405
1406
|
this.setZoomLevel(value);
|
1406
1407
|
}
|
1407
1408
|
else {
|
1408
|
-
this._zoom =
|
1409
|
+
this._zoom = INITIAL_ZOOM_LEVEL;
|
1409
1410
|
this._fitType = zoomToFitOptions[value];
|
1410
1411
|
}
|
1411
1412
|
this._zoomToFit = typeof value !== 'number';
|
@@ -1428,6 +1429,18 @@ class PDFViewerComponent {
|
|
1428
1429
|
* @default 4
|
1429
1430
|
*/
|
1430
1431
|
maxZoom = 4;
|
1432
|
+
/**
|
1433
|
+
* Determines whether all PDF document pages will be initially loaded or new pages will be loaded on demand when needed.
|
1434
|
+
*
|
1435
|
+
* @default false
|
1436
|
+
*/
|
1437
|
+
loadOnDemand = false;
|
1438
|
+
/**
|
1439
|
+
* The number of pages that will be loaded on demand.
|
1440
|
+
*
|
1441
|
+
* @default 1
|
1442
|
+
*/
|
1443
|
+
loadOnDemandPageSize = 1;
|
1431
1444
|
/**
|
1432
1445
|
* The event fired when a PDF document is successfully loaded in the `PDFViewer` component.
|
1433
1446
|
*/
|
@@ -1492,8 +1505,8 @@ class PDFViewerComponent {
|
|
1492
1505
|
* @hidden
|
1493
1506
|
*/
|
1494
1507
|
set enabledSelection(value) {
|
1495
|
-
if (this.
|
1496
|
-
value ? this.
|
1508
|
+
if (this.pdfViewerWidget) {
|
1509
|
+
value ? this.pdfViewerWidget.documentScroller.disablePanEventsTracking() : this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
|
1497
1510
|
}
|
1498
1511
|
this._enabledSelection = value;
|
1499
1512
|
}
|
@@ -1515,14 +1528,14 @@ class PDFViewerComponent {
|
|
1515
1528
|
_zoom = INITIAL_ZOOM_LEVEL;
|
1516
1529
|
_fitType;
|
1517
1530
|
_zoomToFit = false;
|
1518
|
-
pdfScroller;
|
1519
|
-
searchService;
|
1520
1531
|
subs = new Subscription();
|
1521
|
-
|
1532
|
+
emitLoad = true;
|
1533
|
+
constructor(ngZone, renderer, localizationService, cdr, host) {
|
1522
1534
|
this.ngZone = ngZone;
|
1523
1535
|
this.renderer = renderer;
|
1524
1536
|
this.localizationService = localizationService;
|
1525
1537
|
this.cdr = cdr;
|
1538
|
+
this.host = host;
|
1526
1539
|
const isValid = validatePackage(packageMetadata);
|
1527
1540
|
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
1528
1541
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
@@ -1531,21 +1544,9 @@ class PDFViewerComponent {
|
|
1531
1544
|
ngOnInit() {
|
1532
1545
|
this.subs.add(this.localizationService.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
|
1533
1546
|
}
|
1534
|
-
ngAfterViewInit() {
|
1535
|
-
const pagesContainer = this.pagesContainer.nativeElement.parentNode;
|
1536
|
-
this.ngZone.runOutsideAngular(() => this.subs.add(this.renderer.listen(pagesContainer, 'scroll', this.scrollListener)));
|
1537
|
-
}
|
1538
1547
|
ngOnDestroy() {
|
1539
1548
|
this.subs.unsubscribe();
|
1540
|
-
|
1541
|
-
if (this.pdfScroller) {
|
1542
|
-
this.pdfScroller.destroy();
|
1543
|
-
this.pdfScroller = null;
|
1544
|
-
}
|
1545
|
-
if (this.searchService) {
|
1546
|
-
this.searchService.destroy();
|
1547
|
-
this.searchService = null;
|
1548
|
-
}
|
1549
|
+
this.pdfViewerWidget?.destroy();
|
1549
1550
|
this.pdfContext = null;
|
1550
1551
|
}
|
1551
1552
|
ngOnChanges(changes) {
|
@@ -1566,7 +1567,7 @@ class PDFViewerComponent {
|
|
1566
1567
|
* ([see example](slug:tools_pdfviewer#programmatically-scrolling-the-pdfviewer)).
|
1567
1568
|
*/
|
1568
1569
|
scrollToPage(page) {
|
1569
|
-
scrollToPage(
|
1570
|
+
this.pdfViewerWidget?.scrollToPage({ pageNumber: page });
|
1570
1571
|
}
|
1571
1572
|
/**
|
1572
1573
|
* @hidden
|
@@ -1578,18 +1579,13 @@ class PDFViewerComponent {
|
|
1578
1579
|
* @hidden
|
1579
1580
|
*/
|
1580
1581
|
onFileSelectError(e) {
|
1581
|
-
|
1582
|
+
this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
|
1582
1583
|
}
|
1583
1584
|
/**
|
1584
1585
|
* @hidden
|
1585
1586
|
*/
|
1586
1587
|
onPageChange(e) {
|
1587
|
-
this.scrollToPage(e.skip);
|
1588
|
-
hasObservers(this.pageChange) && this.pageChange.emit({
|
1589
|
-
previousPage: this.skip + 1,
|
1590
|
-
currentPage: e.skip + 1
|
1591
|
-
});
|
1592
|
-
this.skip = e.skip;
|
1588
|
+
this.scrollToPage(e.skip + 1);
|
1593
1589
|
}
|
1594
1590
|
/**
|
1595
1591
|
* @hidden
|
@@ -1599,52 +1595,49 @@ class PDFViewerComponent {
|
|
1599
1595
|
.then((data) => new Blob([data], { type: 'application/pdf' }))
|
1600
1596
|
.then((blob) => {
|
1601
1597
|
const downloadEvent = new PDFViewerDownloadEvent(blob, this.saveFileName, this.saveOptions, this.pdfContext);
|
1602
|
-
this.
|
1598
|
+
this.zoneAwareEmitter('download', downloadEvent);
|
1603
1599
|
if (!downloadEvent.isDefaultPrevented()) {
|
1604
1600
|
saveAs(blob, this.saveFileName, this.saveOptions);
|
1605
1601
|
}
|
1606
1602
|
})
|
1607
1603
|
.catch((reason) => {
|
1608
|
-
|
1609
|
-
this.ngZone.run(() => this.error.emit({
|
1610
|
-
error: reason,
|
1611
|
-
context: this.pdfContext
|
1612
|
-
}));
|
1613
|
-
}
|
1604
|
+
this.zoneAwareEmitter('error', { error: reason, context: this.pdfContext });
|
1614
1605
|
}));
|
1615
1606
|
}
|
1607
|
+
/**
|
1608
|
+
* @hidden
|
1609
|
+
*/
|
1610
|
+
stopPropagation = (e) => {
|
1611
|
+
if (e.ctrlKey || e.metaKey) {
|
1612
|
+
e.preventDefault();
|
1613
|
+
}
|
1614
|
+
};
|
1616
1615
|
/**
|
1617
1616
|
* @hidden
|
1618
1617
|
*/
|
1619
1618
|
onZoomIn() {
|
1620
|
-
const newZoom = Math.min(this.
|
1621
|
-
if (newZoom !== this.
|
1622
|
-
|
1623
|
-
this.
|
1624
|
-
|
1625
|
-
|
1626
|
-
});
|
1627
|
-
}
|
1619
|
+
const newZoom = Math.min(this.zoom + this.zoomRate, this.maxZoom);
|
1620
|
+
if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
|
1621
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
1622
|
+
previousZoomLevel: this.zoom,
|
1623
|
+
currentZoomLevel: newZoom
|
1624
|
+
});
|
1628
1625
|
this.zoom = this.pdfContext.zoom = newZoom;
|
1629
1626
|
this.setZoomLevel(newZoom);
|
1630
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
1631
1627
|
}
|
1632
1628
|
}
|
1633
1629
|
/**
|
1634
1630
|
* @hidden
|
1635
1631
|
*/
|
1636
1632
|
onZoomOut() {
|
1637
|
-
const newZoom = Math.max(this.
|
1638
|
-
if (newZoom !== this.
|
1639
|
-
|
1640
|
-
this.
|
1641
|
-
|
1642
|
-
|
1643
|
-
});
|
1644
|
-
}
|
1633
|
+
const newZoom = Math.max(this.zoom - this.zoomRate, this.minZoom);
|
1634
|
+
if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
|
1635
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
1636
|
+
previousZoomLevel: this.zoom,
|
1637
|
+
currentZoomLevel: newZoom
|
1638
|
+
});
|
1645
1639
|
this.zoom = this.pdfContext.zoom = newZoom;
|
1646
1640
|
this.setZoomLevel(newZoom);
|
1647
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
1648
1641
|
}
|
1649
1642
|
}
|
1650
1643
|
/**
|
@@ -1658,55 +1651,40 @@ class PDFViewerComponent {
|
|
1658
1651
|
text: '100%'
|
1659
1652
|
};
|
1660
1653
|
}
|
1661
|
-
let newZoom =
|
1662
|
-
|
1654
|
+
let newZoom = zoomLevel.type ? this.pdfViewerWidget?.calculateZoomLevel({
|
1655
|
+
zoomLevel: zoomLevel.value,
|
1656
|
+
zoomLevelType: zoomLevel.type,
|
1657
|
+
currentZoom: this.zoom
|
1658
|
+
}) : Math.min(Math.max(zoomLevel.value, this.minZoom), this.maxZoom);
|
1659
|
+
newZoom = Math.floor(newZoom * 100) / 100;
|
1663
1660
|
const sameZoom = this.zoom === newZoom;
|
1664
|
-
if (!sameZoom
|
1665
|
-
this.zoomLevelChange
|
1661
|
+
if (!sameZoom) {
|
1662
|
+
emit && this.zoneAwareEmitter('zoomLevelChange', {
|
1666
1663
|
previousZoomLevel: this.zoom,
|
1667
1664
|
currentZoomLevel: newZoom
|
1668
1665
|
});
|
1666
|
+
this.zoom = this.pdfContext.zoom = newZoom;
|
1669
1667
|
}
|
1670
|
-
this.
|
1671
|
-
this.setZoomLevel(newZoom);
|
1672
|
-
this.ngZone.runOutsideAngular(() => this.reloadDocument());
|
1668
|
+
this.setZoomLevel(newZoom, zoomLevel.type);
|
1673
1669
|
}
|
1674
1670
|
/**
|
1675
1671
|
* @hidden
|
1676
1672
|
*/
|
1677
1673
|
onSearch() {
|
1678
1674
|
this.searchActive = true;
|
1679
|
-
this.ngZone.runOutsideAngular(() => {
|
1680
|
-
const pagesTextLayers = Array.from(this.pagesContainer.nativeElement.querySelectorAll('.k-text-layer'));
|
1681
|
-
this.searchService = new SearchService({
|
1682
|
-
textContainers: pagesTextLayers || [],
|
1683
|
-
highlightClass: 'k-search-highlight',
|
1684
|
-
highlightMarkClass: 'k-search-highlight-mark',
|
1685
|
-
charClass: 'k-text-char'
|
1686
|
-
});
|
1687
|
-
});
|
1688
1675
|
}
|
1689
1676
|
/**
|
1690
1677
|
* @hidden
|
1691
1678
|
*/
|
1692
1679
|
onPrint() {
|
1693
1680
|
this.loading = true;
|
1694
|
-
|
1695
|
-
this.loading = false;
|
1696
|
-
if (hasObservers(this.error)) {
|
1697
|
-
this.error.emit(e);
|
1698
|
-
}
|
1699
|
-
};
|
1700
|
-
const onDone = () => {
|
1701
|
-
this.loading = false;
|
1702
|
-
};
|
1703
|
-
print(this.pdfContext.pdfPages, onDone, onError);
|
1681
|
+
this.pdfViewerWidget?.printFile();
|
1704
1682
|
}
|
1705
1683
|
/**
|
1706
1684
|
* @hidden
|
1707
1685
|
*/
|
1708
1686
|
onSearchChange(e) {
|
1709
|
-
this.currentMatches = this.searchService.search({ ...e });
|
1687
|
+
this.currentMatches = this.pdfViewerWidget.searchService.search({ ...e });
|
1710
1688
|
this.currentMatch = this.currentMatches.length ? 1 : 0;
|
1711
1689
|
}
|
1712
1690
|
/**
|
@@ -1714,7 +1692,7 @@ class PDFViewerComponent {
|
|
1714
1692
|
*/
|
1715
1693
|
closeSearch(toolbar) {
|
1716
1694
|
this.searchActive = false;
|
1717
|
-
this.searchService.destroy();
|
1695
|
+
this.pdfViewerWidget.searchService.destroy();
|
1718
1696
|
this.currentMatches = [];
|
1719
1697
|
this.currentMatch = null;
|
1720
1698
|
toolbar.focus();
|
@@ -1723,57 +1701,45 @@ class PDFViewerComponent {
|
|
1723
1701
|
* @hidden
|
1724
1702
|
*/
|
1725
1703
|
onNextMatch() {
|
1726
|
-
goToNextSearchMatch(
|
1704
|
+
this.pdfViewerWidget?.goToNextSearchMatch();
|
1727
1705
|
this.currentMatch = this.currentMatch + 1 > this.currentMatches.length ? 1 : this.currentMatch + 1;
|
1728
1706
|
}
|
1729
1707
|
/**
|
1730
1708
|
* @hidden
|
1731
1709
|
*/
|
1732
1710
|
onPreviousMatch() {
|
1733
|
-
goToPreviousSearchMatch(
|
1711
|
+
this.pdfViewerWidget?.goToPreviousSearchMatch();
|
1734
1712
|
this.currentMatch = this.currentMatch - 1 < 1 ? this.currentMatches.length : this.currentMatch - 1;
|
1735
1713
|
}
|
1714
|
+
pdfViewerWidget;
|
1736
1715
|
loadPdf(dataType, data) {
|
1716
|
+
this.pdfViewerWidget?.destroy();
|
1737
1717
|
this.loading = true;
|
1718
|
+
this.emitLoad = true;
|
1738
1719
|
this.ngZone.runOutsideAngular(() => setTimeout(() => {
|
1720
|
+
// try to destroy if new dynamic data source
|
1739
1721
|
removeChildren(this.pagesContainer.nativeElement);
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
pdfDoc: this.pdfContext?.pdfDoc,
|
1755
|
-
zoom: this.zoom,
|
1756
|
-
dom: this.pagesContainer.nativeElement,
|
1757
|
-
done: (pdfPages) => {
|
1758
|
-
this.pdfContext.pdfPages = pdfPages;
|
1759
|
-
this.ngZone.run(() => {
|
1722
|
+
const file = dataType === 'src' || dataType === 'data' ? { [dataType]: data } : { data };
|
1723
|
+
this.pdfViewerWidget = new PdfViewer(this.host.nativeElement, {
|
1724
|
+
loadOnDemand: this.loadOnDemand,
|
1725
|
+
loadOnDemandPageSize: this.loadOnDemandPageSize,
|
1726
|
+
zoomLevel: this.zoom,
|
1727
|
+
scaleFactor: 1,
|
1728
|
+
fileDescriptor: file,
|
1729
|
+
events: {
|
1730
|
+
pagesLoad: this.loadHandler,
|
1731
|
+
zoomStart: () => {
|
1732
|
+
this.skip = this.pdfViewerWidget.getCurrentPageIndex();
|
1733
|
+
},
|
1734
|
+
zoomEnd: this.zoomEndHandler,
|
1735
|
+
printEnd: () => {
|
1760
1736
|
this.loading = false;
|
1761
|
-
|
1762
|
-
|
1763
|
-
this.
|
1764
|
-
},
|
1765
|
-
error: (e) => {
|
1766
|
-
if (this.pdfScroller) {
|
1767
|
-
this.pdfScroller.destroy();
|
1768
|
-
this.pdfScroller = null;
|
1769
|
-
}
|
1770
|
-
this.pdfContext = null;
|
1771
|
-
if (hasObservers(this.error)) {
|
1772
|
-
this.ngZone.run(() => this.error.emit({ error: e, context: this.pdfContext }));
|
1773
|
-
}
|
1737
|
+
},
|
1738
|
+
scroll: this.scrollHandler,
|
1739
|
+
error: this.errorHandler
|
1774
1740
|
}
|
1775
1741
|
});
|
1776
|
-
}
|
1742
|
+
}));
|
1777
1743
|
}
|
1778
1744
|
assignPageIds() {
|
1779
1745
|
this.pagesContainer.nativeElement.querySelectorAll('.k-page').forEach((pageElement, index) => {
|
@@ -1781,13 +1747,15 @@ class PDFViewerComponent {
|
|
1781
1747
|
this.renderer.setAttribute(pageElement, 'id', id);
|
1782
1748
|
});
|
1783
1749
|
}
|
1784
|
-
setZoomLevel(zoom) {
|
1785
|
-
const option = this.zoomOptionsData.find(item => !item.type && item.value === zoom);
|
1786
|
-
this.zoomLevel = option
|
1750
|
+
setZoomLevel(zoom, type) {
|
1751
|
+
const option = this.zoomOptionsData.find(item => (!item.type && item.value === zoom) || (item.type && item.type === type));
|
1752
|
+
this.zoomLevel = structuredClone(option) ?? {
|
1787
1753
|
value: zoom,
|
1788
1754
|
displayValue: `${Math.round(zoom * 100)}%`,
|
1789
1755
|
text: `${Math.round(zoom * 100)}%`
|
1790
1756
|
};
|
1757
|
+
this.pdfViewerWidget?.setState({ zoomLevel: zoom });
|
1758
|
+
this.pdfViewerWidget?.reloadFile(this.pdfContext.pdfDoc);
|
1791
1759
|
}
|
1792
1760
|
verifySettings(changes) {
|
1793
1761
|
const sourceTypes = ['url', 'arrayBuffer', 'data', 'typedArray'];
|
@@ -1802,54 +1770,61 @@ class PDFViewerComponent {
|
|
1802
1770
|
isSet(changes, source) {
|
1803
1771
|
return this[source] || changes[source]?.currentValue;
|
1804
1772
|
}
|
1805
|
-
|
1806
|
-
const
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
this.skip = nextPage;
|
1773
|
+
scrollHandler = (e) => {
|
1774
|
+
const currentPage = this.currentPage;
|
1775
|
+
this.skip = e.pageNumber - 1;
|
1776
|
+
this.cdr.markForCheck();
|
1777
|
+
if (e.isPageChanged) {
|
1778
|
+
this.zoneAwareEmitter('pageChange', {
|
1779
|
+
previousPage: currentPage,
|
1780
|
+
currentPage: e.pageNumber
|
1814
1781
|
});
|
1815
1782
|
}
|
1816
1783
|
};
|
1817
1784
|
loadHandler = (e) => {
|
1785
|
+
if (!this.pdfContext) {
|
1786
|
+
this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
|
1787
|
+
}
|
1818
1788
|
if (!this._zoomToFit) {
|
1819
1789
|
this.ngZone.run(() => {
|
1820
|
-
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
|
1790
|
+
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement, zoom: e.sender.state.zoomLevel };
|
1821
1791
|
this.loading = false;
|
1822
|
-
this.
|
1792
|
+
if (this.emitLoad) {
|
1793
|
+
this.zoneAwareEmitter('load', { context: this.pdfContext });
|
1794
|
+
this.emitLoad = false;
|
1795
|
+
}
|
1823
1796
|
});
|
1824
1797
|
}
|
1825
1798
|
else {
|
1826
1799
|
const zoomLevelOption = this.zoomOptionsData.find(item => item.type === this._fitType);
|
1827
1800
|
this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
|
1828
1801
|
this.onZoomLevelChange(zoomLevelOption, false);
|
1829
|
-
this.
|
1830
|
-
}
|
1831
|
-
if (this.pdfScroller) {
|
1832
|
-
this.pdfScroller.destroy();
|
1802
|
+
this.pdfViewerWidget.reloadFile(this.pdfContext.pdfDoc);
|
1833
1803
|
}
|
1834
|
-
this.
|
1835
|
-
filter: '.k-page',
|
1836
|
-
events: {}
|
1837
|
-
});
|
1838
|
-
this.pdfScroller.enablePanEventsTracking();
|
1804
|
+
this.cdr.markForCheck();
|
1839
1805
|
this.assignPageIds();
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1806
|
+
};
|
1807
|
+
zoomEndHandler = (e) => {
|
1808
|
+
const zoom = Math.min(Math.max(e.zoomLevel, this.minZoom), this.maxZoom);
|
1809
|
+
this.zoneAwareEmitter('zoomLevelChange', {
|
1810
|
+
currentZoomLevel: zoom,
|
1811
|
+
previousZoomLevel: this.zoom
|
1812
|
+
});
|
1813
|
+
this.zoom = zoom;
|
1814
|
+
this.setZoomLevel(zoom);
|
1843
1815
|
};
|
1844
1816
|
errorHandler = (e) => {
|
1845
1817
|
this.ngZone.run(() => this.loading = false);
|
1846
1818
|
this.pdfContext = null;
|
1847
|
-
|
1848
|
-
|
1819
|
+
this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
|
1820
|
+
};
|
1821
|
+
zoneAwareEmitter = (eventName, eventData) => {
|
1822
|
+
if (hasObservers(this[eventName])) {
|
1823
|
+
this.ngZone.run(() => this[eventName].emit(eventData));
|
1849
1824
|
}
|
1850
1825
|
};
|
1851
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1852
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PDFViewerComponent, isStandalone: true, selector: "kendo-pdfviewer", inputs: { tools: "tools", loaderSettings: "loaderSettings", saveFileName: "saveFileName", saveOptions: "saveOptions", url: "url", data: "data", arrayBuffer: "arrayBuffer", typedArray: "typedArray", zoom: "zoom", zoomRate: "zoomRate", minZoom: "minZoom", maxZoom: "maxZoom" }, outputs: { load: "load", error: "error", download: "download", pageChange: "pageChange", zoomLevelChange: "zoomLevelChange" }, host: { properties: { "class.k-pdf-viewer": "this.hostClass", "attr.dir": "this.direction" } }, providers: [
|
1826
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
1827
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PDFViewerComponent, isStandalone: true, selector: "kendo-pdfviewer", inputs: { tools: "tools", loaderSettings: "loaderSettings", saveFileName: "saveFileName", saveOptions: "saveOptions", url: "url", data: "data", arrayBuffer: "arrayBuffer", typedArray: "typedArray", zoom: "zoom", zoomRate: "zoomRate", minZoom: "minZoom", maxZoom: "maxZoom", loadOnDemand: "loadOnDemand", loadOnDemandPageSize: "loadOnDemandPageSize" }, outputs: { load: "load", error: "error", download: "download", pageChange: "pageChange", zoomLevelChange: "zoomLevelChange" }, host: { properties: { "class.k-pdf-viewer": "this.hostClass", "attr.dir": "this.direction" } }, providers: [
|
1853
1828
|
LocalizationService,
|
1854
1829
|
{
|
1855
1830
|
provide: L10N_PREFIX,
|
@@ -1978,17 +1953,15 @@ class PDFViewerComponent {
|
|
1978
1953
|
(close)="closeSearch(toolbar)"></div>
|
1979
1954
|
<div
|
1980
1955
|
#pagesContainer
|
1956
|
+
[kendoEventsOutsideAngular]="{
|
1957
|
+
wheel: stopPropagation
|
1958
|
+
}"
|
1981
1959
|
class="k-pdf-viewer-pages"
|
1982
|
-
[
|
1983
|
-
[attr.id]="pagesContainerId">
|
1984
|
-
<div class="k-page">
|
1985
|
-
<div class="k-text-layer"></div>
|
1986
|
-
</div>
|
1987
|
-
</div>
|
1960
|
+
[attr.id]="pagesContainerId"></div>
|
1988
1961
|
</div>
|
1989
1962
|
|
1990
1963
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
1991
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedPDFViewerMessagesDirective, selector: "[kendoPDFViewerLocalizedMessages]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LoaderComponent, selector: "[kendoPDFViewerLoader]", inputs: ["settings"] }, { kind: "component", type: ToolbarComponent, selector: "[kendoPDFViewerToolbar]", inputs: ["zoomLevel", "calculatedComboBoxValue", "skip", "pageSize", "total", "zoomInDisabled", "zoomOutDisabled", "disabledTools", "zoomLevelChooserValue", "zoomOptionsData", "pagesContainerId", "tools"], outputs: ["fileSelect", "fileSelectStart", "fileSelectError", "download", "selectionEnabled", "panningEnabled", "pageChange", "zoomIn", "zoomOut", "zoomLevelChange", "print", "search"] }, { kind: "component", type: PDFViewerSearchComponent, selector: "[kendoPDFViewerSearch]", inputs: ["matches", "currentMatch"], outputs: ["searchChange", "prevMatch", "nextMatch", "close"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]" }] });
|
1964
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedPDFViewerMessagesDirective, selector: "[kendoPDFViewerLocalizedMessages]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "component", type: LoaderComponent, selector: "[kendoPDFViewerLoader]", inputs: ["settings"] }, { kind: "component", type: ToolbarComponent, selector: "[kendoPDFViewerToolbar]", inputs: ["zoomLevel", "calculatedComboBoxValue", "skip", "pageSize", "total", "zoomInDisabled", "zoomOutDisabled", "disabledTools", "zoomLevelChooserValue", "zoomOptionsData", "pagesContainerId", "tools"], outputs: ["fileSelect", "fileSelectStart", "fileSelectError", "download", "selectionEnabled", "panningEnabled", "pageChange", "zoomIn", "zoomOut", "zoomLevelChange", "print", "search"] }, { kind: "component", type: PDFViewerSearchComponent, selector: "[kendoPDFViewerSearch]", inputs: ["matches", "currentMatch"], outputs: ["searchChange", "prevMatch", "nextMatch", "close"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]" }] });
|
1992
1965
|
}
|
1993
1966
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, decorators: [{
|
1994
1967
|
type: Component,
|
@@ -2125,21 +2098,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2125
2098
|
(close)="closeSearch(toolbar)"></div>
|
2126
2099
|
<div
|
2127
2100
|
#pagesContainer
|
2101
|
+
[kendoEventsOutsideAngular]="{
|
2102
|
+
wheel: stopPropagation
|
2103
|
+
}"
|
2128
2104
|
class="k-pdf-viewer-pages"
|
2129
|
-
[
|
2130
|
-
[attr.id]="pagesContainerId">
|
2131
|
-
<div class="k-page">
|
2132
|
-
<div class="k-text-layer"></div>
|
2133
|
-
</div>
|
2134
|
-
</div>
|
2105
|
+
[attr.id]="pagesContainerId"></div>
|
2135
2106
|
</div>
|
2136
2107
|
|
2137
2108
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
2138
2109
|
`,
|
2139
2110
|
standalone: true,
|
2140
|
-
imports: [LocalizedPDFViewerMessagesDirective, NgIf, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
|
2111
|
+
imports: [LocalizedPDFViewerMessagesDirective, NgIf, EventsOutsideAngularDirective, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
|
2141
2112
|
}]
|
2142
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
|
2113
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { hostClass: [{
|
2143
2114
|
type: HostBinding,
|
2144
2115
|
args: ['class.k-pdf-viewer']
|
2145
2116
|
}], direction: [{
|
@@ -2169,6 +2140,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
2169
2140
|
type: Input
|
2170
2141
|
}], maxZoom: [{
|
2171
2142
|
type: Input
|
2143
|
+
}], loadOnDemand: [{
|
2144
|
+
type: Input
|
2145
|
+
}], loadOnDemandPageSize: [{
|
2146
|
+
type: Input
|
2172
2147
|
}], load: [{
|
2173
2148
|
type: Output
|
2174
2149
|
}], error: [{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@progress/kendo-angular-pdfviewer",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.5.0-develop.10",
|
4
4
|
"description": "Kendo UI PDFViewer for Angular",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
6
6
|
"author": "Progress",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"package": {
|
20
20
|
"productName": "Kendo UI for Angular",
|
21
21
|
"productCode": "KENDOUIANGULAR",
|
22
|
-
"publishDate":
|
22
|
+
"publishDate": 1744092635,
|
23
23
|
"licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"
|
24
24
|
}
|
25
25
|
},
|
@@ -29,23 +29,23 @@
|
|
29
29
|
"@angular/core": "16 - 19",
|
30
30
|
"@angular/platform-browser": "16 - 19",
|
31
31
|
"@progress/kendo-licensing": "^1.5.0",
|
32
|
-
"@progress/kendo-angular-buttons": "18.
|
33
|
-
"@progress/kendo-angular-common": "18.
|
34
|
-
"@progress/kendo-angular-dropdowns": "18.
|
35
|
-
"@progress/kendo-angular-inputs": "18.
|
36
|
-
"@progress/kendo-angular-intl": "18.
|
37
|
-
"@progress/kendo-angular-l10n": "18.
|
38
|
-
"@progress/kendo-angular-icons": "18.
|
39
|
-
"@progress/kendo-angular-indicators": "18.
|
40
|
-
"@progress/kendo-angular-pager": "18.
|
41
|
-
"@progress/kendo-angular-popup": "18.
|
32
|
+
"@progress/kendo-angular-buttons": "18.5.0-develop.10",
|
33
|
+
"@progress/kendo-angular-common": "18.5.0-develop.10",
|
34
|
+
"@progress/kendo-angular-dropdowns": "18.5.0-develop.10",
|
35
|
+
"@progress/kendo-angular-inputs": "18.5.0-develop.10",
|
36
|
+
"@progress/kendo-angular-intl": "18.5.0-develop.10",
|
37
|
+
"@progress/kendo-angular-l10n": "18.5.0-develop.10",
|
38
|
+
"@progress/kendo-angular-icons": "18.5.0-develop.10",
|
39
|
+
"@progress/kendo-angular-indicators": "18.5.0-develop.10",
|
40
|
+
"@progress/kendo-angular-pager": "18.5.0-develop.10",
|
41
|
+
"@progress/kendo-angular-popup": "18.5.0-develop.10",
|
42
42
|
"rxjs": "^6.5.3 || ^7.0.0"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
45
|
"tslib": "^2.3.1",
|
46
|
-
"@progress/kendo-angular-schematics": "18.
|
46
|
+
"@progress/kendo-angular-schematics": "18.5.0-develop.10",
|
47
47
|
"@progress/kendo-file-saver": "^1.0.1",
|
48
|
-
"@progress/kendo-pdfviewer-common": "0.4.
|
48
|
+
"@progress/kendo-pdfviewer-common": "0.4.1"
|
49
49
|
},
|
50
50
|
"schematics": "./schematics/collection.json",
|
51
51
|
"module": "fesm2022/progress-kendo-angular-pdfviewer.mjs",
|
package/pdfviewer.component.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
|
-
import {
|
5
|
+
import { ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, Renderer2, SimpleChanges } from '@angular/core';
|
6
6
|
import { LoaderSettings } from './models/loader-settings';
|
7
7
|
import { TypedArray } from '@progress/kendo-pdfviewer-common';
|
8
8
|
import { PDFViewerContext } from './models/pdfviewer-context';
|
@@ -18,11 +18,12 @@ import * as i0 from "@angular/core";
|
|
18
18
|
/**
|
19
19
|
* Represents the [Kendo UI PDFViewer component for Angular]({% slug overview_pdfviewer %}).
|
20
20
|
*/
|
21
|
-
export declare class PDFViewerComponent implements OnInit,
|
21
|
+
export declare class PDFViewerComponent implements OnInit, OnDestroy {
|
22
22
|
private ngZone;
|
23
23
|
private renderer;
|
24
24
|
private localizationService;
|
25
25
|
private cdr;
|
26
|
+
private host;
|
26
27
|
hostClass: boolean;
|
27
28
|
direction: string;
|
28
29
|
/**
|
@@ -84,6 +85,18 @@ export declare class PDFViewerComponent implements OnInit, AfterViewInit, OnDest
|
|
84
85
|
* @default 4
|
85
86
|
*/
|
86
87
|
maxZoom: number;
|
88
|
+
/**
|
89
|
+
* Determines whether all PDF document pages will be initially loaded or new pages will be loaded on demand when needed.
|
90
|
+
*
|
91
|
+
* @default false
|
92
|
+
*/
|
93
|
+
loadOnDemand: boolean;
|
94
|
+
/**
|
95
|
+
* The number of pages that will be loaded on demand.
|
96
|
+
*
|
97
|
+
* @default 1
|
98
|
+
*/
|
99
|
+
loadOnDemandPageSize: number;
|
87
100
|
/**
|
88
101
|
* The event fired when a PDF document is successfully loaded in the `PDFViewer` component.
|
89
102
|
*/
|
@@ -159,12 +172,10 @@ export declare class PDFViewerComponent implements OnInit, AfterViewInit, OnDest
|
|
159
172
|
private _zoom;
|
160
173
|
private _fitType;
|
161
174
|
private _zoomToFit;
|
162
|
-
private pdfScroller;
|
163
|
-
private searchService;
|
164
175
|
private subs;
|
165
|
-
|
176
|
+
private emitLoad;
|
177
|
+
constructor(ngZone: NgZone, renderer: Renderer2, localizationService: LocalizationService, cdr: ChangeDetectorRef, host: ElementRef);
|
166
178
|
ngOnInit(): void;
|
167
|
-
ngAfterViewInit(): void;
|
168
179
|
ngOnDestroy(): void;
|
169
180
|
ngOnChanges(changes: SimpleChanges): void;
|
170
181
|
/**
|
@@ -188,6 +199,10 @@ export declare class PDFViewerComponent implements OnInit, AfterViewInit, OnDest
|
|
188
199
|
* @hidden
|
189
200
|
*/
|
190
201
|
onDownload(): void;
|
202
|
+
/**
|
203
|
+
* @hidden
|
204
|
+
*/
|
205
|
+
stopPropagation: (e: any) => void;
|
191
206
|
/**
|
192
207
|
* @hidden
|
193
208
|
*/
|
@@ -227,15 +242,17 @@ export declare class PDFViewerComponent implements OnInit, AfterViewInit, OnDest
|
|
227
242
|
* @hidden
|
228
243
|
*/
|
229
244
|
onPreviousMatch(): void;
|
245
|
+
private pdfViewerWidget;
|
230
246
|
private loadPdf;
|
231
|
-
private reloadDocument;
|
232
247
|
private assignPageIds;
|
233
248
|
private setZoomLevel;
|
234
249
|
private verifySettings;
|
235
250
|
private isSet;
|
236
|
-
private
|
251
|
+
private scrollHandler;
|
237
252
|
private loadHandler;
|
253
|
+
private zoomEndHandler;
|
238
254
|
private errorHandler;
|
255
|
+
private zoneAwareEmitter;
|
239
256
|
static ɵfac: i0.ɵɵFactoryDeclaration<PDFViewerComponent, never>;
|
240
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PDFViewerComponent, "kendo-pdfviewer", ["kendo-pdfviewer"], { "tools": { "alias": "tools"; "required": false; }; "loaderSettings": { "alias": "loaderSettings"; "required": false; }; "saveFileName": { "alias": "saveFileName"; "required": false; }; "saveOptions": { "alias": "saveOptions"; "required": false; }; "url": { "alias": "url"; "required": false; }; "data": { "alias": "data"; "required": false; }; "arrayBuffer": { "alias": "arrayBuffer"; "required": false; }; "typedArray": { "alias": "typedArray"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; }, { "load": "load"; "error": "error"; "download": "download"; "pageChange": "pageChange"; "zoomLevelChange": "zoomLevelChange"; }, never, never, true, never>;
|
257
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PDFViewerComponent, "kendo-pdfviewer", ["kendo-pdfviewer"], { "tools": { "alias": "tools"; "required": false; }; "loaderSettings": { "alias": "loaderSettings"; "required": false; }; "saveFileName": { "alias": "saveFileName"; "required": false; }; "saveOptions": { "alias": "saveOptions"; "required": false; }; "url": { "alias": "url"; "required": false; }; "data": { "alias": "data"; "required": false; }; "arrayBuffer": { "alias": "arrayBuffer"; "required": false; }; "typedArray": { "alias": "typedArray"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "loadOnDemand": { "alias": "loadOnDemand"; "required": false; }; "loadOnDemandPageSize": { "alias": "loadOnDemandPageSize"; "required": false; }; }, { "load": "load"; "error": "error"; "download": "download"; "pageChange": "pageChange"; "zoomLevelChange": "zoomLevelChange"; }, never, never, true, never>;
|
241
258
|
}
|
@@ -4,8 +4,8 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
4
4
|
function default_1(options) {
|
5
5
|
const finalOptions = Object.assign(Object.assign({}, options), { mainNgModule: 'PDFViewerModule', package: 'pdfviewer', peerDependencies: {
|
6
6
|
// peers of the dropdowns
|
7
|
-
'@progress/kendo-angular-navigation': '18.
|
8
|
-
'@progress/kendo-angular-treeview': '18.
|
7
|
+
'@progress/kendo-angular-navigation': '18.5.0-develop.10',
|
8
|
+
'@progress/kendo-angular-treeview': '18.5.0-develop.10'
|
9
9
|
} });
|
10
10
|
return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
|
11
11
|
}
|