@progress/kendo-angular-pdfviewer 21.4.1-develop.1 → 22.0.0-develop.1

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.
@@ -1,1152 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, ViewChild, ViewContainerRef, isDevMode } from '@angular/core';
6
- import { validatePackage } from '@progress/kendo-licensing';
7
- import { packageMetadata } from './package-metadata';
8
- import { INITIAL_ZOOM_LEVEL, zoomOptionsData, zoomToFitOptions } from './util';
9
- import { PdfViewer, removeChildren, PdfViewerInteractionMode, } from '@progress/kendo-pdfviewer-common';
10
- import { EventsOutsideAngularDirective, hasObservers, shouldShowValidationUI, getLicenseMessage, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
11
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
12
- import { PDFViewerDownloadEvent } from './models/events';
13
- import { Subscription } from 'rxjs';
14
- import { ToolbarComponent } from './toolbar/toolbar.component';
15
- import { PDFViewerSearchComponent } from './toolbar/search.component';
16
- import { LoaderComponent } from './loader/loader.component';
17
- import { LocalizedPDFViewerMessagesDirective } from './localization/localized-messages.directive';
18
- import 'pdfjs-dist/build/pdf.worker.min.mjs';
19
- import { AnnotationEditorTypes } from './models/annotation-editor.type';
20
- import { PopupService } from '@progress/kendo-angular-popup';
21
- import { AnnotationPopupToolbarContentComponent } from './annotations/annotation-editor';
22
- import * as i0 from "@angular/core";
23
- import * as i1 from "@progress/kendo-angular-l10n";
24
- import * as i2 from "@progress/kendo-angular-popup";
25
- let counter = 0;
26
- /**
27
- * Represents the [Kendo UI PDFViewer component for Angular](slug:overview_pdfviewer).
28
- *
29
- * @example
30
- * ```html
31
- * <kendo-pdfviewer
32
- * [url]="pdfUrl"
33
- * [zoom]="1.25"
34
- * [tools]="['pager', 'zoomInOut', 'zoom', 'download', 'print']">
35
- * </kendo-pdfviewer>
36
- * ```
37
- *
38
- * @remarks
39
- * Supported children components are: {@link PDFViewerCustomMessagesComponent}
40
- */
41
- export class PDFViewerComponent {
42
- ngZone;
43
- renderer;
44
- localizationService;
45
- cdr;
46
- host;
47
- popupService;
48
- hostClass = true;
49
- direction;
50
- display = 'flex';
51
- /**
52
- * Represents the tools collection rendered in the toolbar.
53
- * @default ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print', 'annotations' ]
54
- */
55
- tools = [
56
- 'pager',
57
- 'spacer',
58
- 'zoomInOut',
59
- 'zoom',
60
- 'selection',
61
- 'spacer',
62
- 'search',
63
- 'open',
64
- 'download',
65
- 'print',
66
- 'annotations'
67
- ];
68
- /**
69
- * The configuration of the internal Loader component.
70
- * @default { size: 'large', type: 'pulsing', themeColor: 'primary' }
71
- */
72
- loaderSettings = {
73
- size: 'large',
74
- type: 'pulsing',
75
- themeColor: 'primary'
76
- };
77
- /**
78
- * Enables form filling capabilities by rendering widgets such as:
79
- *
80
- * - Text Box&mdash;Enables users to input and edit text within designated form fields.
81
- * - Password Box&mdash;Provides secure entry of sensitive information through password-protected fields.
82
- * - Check Box&mdash;Lets users toggle between selected and deselected states for predefined options.
83
- * - Radio Button&mdash;Implements radio button functionality for selecting exclusive options within a group.
84
- * - Select&mdash;Allows users to select one or multiple options from a list of predefined items.
85
- * @default false
86
- */
87
- renderForms = false;
88
- /**
89
- * The name of the file that will be saved when the end user clicks the Download tool.
90
- * @default 'Download'
91
- */
92
- saveFileName = 'Download';
93
- /**
94
- * Represents the options for saving the file when the end user clicks the Download tool.
95
- * @default {}
96
- */
97
- saveOptions = {};
98
- /**
99
- * Represents the url of the PDF file.
100
- */
101
- url;
102
- /**
103
- * Represents the data of the PDF file in [Base64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
104
- */
105
- data;
106
- /**
107
- * Represents the raw [binary data buffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) of the PDF file.
108
- */
109
- arrayBuffer;
110
- /**
111
- * Represents the data of the PDF file in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) format.
112
- */
113
- typedArray;
114
- /**
115
- * Sets the initial zoom level of the PDF document
116
- * ([see example](slug:tools_pdfviewer#zooming-tools)).
117
- *
118
- * @default 1.25
119
- */
120
- set zoom(value) {
121
- if (typeof value === 'number') {
122
- this._zoom = value;
123
- this._fitType = null;
124
- this.setZoomLevel(value);
125
- }
126
- else {
127
- this._zoom = INITIAL_ZOOM_LEVEL;
128
- this._fitType = zoomToFitOptions[value];
129
- }
130
- this._zoomToFit = typeof value !== 'number';
131
- }
132
- get zoom() {
133
- return this._zoom;
134
- }
135
- /**
136
- * Represents the step the zoom level will be changed with when using the **ZoomIn** and **ZoomOut** tools.
137
- * @default 0.25
138
- */
139
- zoomRate = 0.25;
140
- /**
141
- * Represents minimum allowed zoom value.
142
- * @default 0.5
143
- */
144
- minZoom = 0.5;
145
- /**
146
- * Represents maximum allowed zoom value.
147
- * @default 4
148
- */
149
- maxZoom = 4;
150
- /**
151
- * Sets whether the component loads all PDF document pages at once or loads new pages on demand when needed.
152
- *
153
- * @default false
154
- */
155
- loadOnDemand = false;
156
- /**
157
- * Sets the number of pages to load on demand when the `loadOnDemand` property is `true`.
158
- *
159
- * @default 1
160
- */
161
- loadOnDemandPageSize = 1;
162
- /**
163
- * Determines whether a confirmation dialog is shown when the user tries to delete an annotation.
164
- *
165
- * @default true
166
- */
167
- removeAnnotationConfirmation = true;
168
- /**
169
- * Fires when the component loads a PDF document successfully.
170
- */
171
- load = new EventEmitter();
172
- /**
173
- * Fires when an error occurs while loading or downloading the PDF document.
174
- */
175
- error = new EventEmitter();
176
- /**
177
- * Fires when the user clicks the **Download** tool of the loaded PDF document.
178
- */
179
- download = new EventEmitter();
180
- /**
181
- * Fires when the user changes the page of the loaded PDF document.
182
- */
183
- pageChange = new EventEmitter();
184
- /**
185
- * Fires when the user changes the zoom level of the loaded PDF document.
186
- */
187
- zoomLevelChange = new EventEmitter();
188
- pagesContainer;
189
- pagesContainerViewContainerRef;
190
- dialogContainerViewContainerRef;
191
- /**
192
- * Returns the current page number of the loaded PDF document.
193
- */
194
- get currentPage() {
195
- const isDocumentLoaded = this.pagesContainer && this.pdfContext?.pdfDoc;
196
- return isDocumentLoaded ? this.skip + 1 : null;
197
- }
198
- set pdfContext(doc) {
199
- this._pdfContext = doc;
200
- }
201
- /**
202
- * Exposes the loaded `PDF.js` document, its pages, and their DOM element wrapper.
203
- */
204
- get pdfContext() {
205
- return this._pdfContext;
206
- }
207
- /**
208
- * @hidden
209
- */
210
- get activePageId() {
211
- if (!this.pdfContext?.pdfPages.length) {
212
- return;
213
- }
214
- return this.pagesContainer.nativeElement.querySelectorAll('.k-page')[this.skip]?.getAttribute('id');
215
- }
216
- /**
217
- * @hidden
218
- */
219
- get pagesContainerId() {
220
- if (!this.pdfContext?.pdfPages.length) {
221
- return;
222
- }
223
- return `k-pdfviewer-${counter}-pages-container`;
224
- }
225
- /**
226
- * @hidden
227
- */
228
- get annotationsToolbarId() {
229
- return `k-pdfviewer-${counter}-annotations-toolbar`;
230
- }
231
- /**
232
- * @hidden
233
- */
234
- get annotationsToolId() {
235
- return `k-pdfviewer-${counter}-annotations-button`;
236
- }
237
- loading = false;
238
- searchActive = false;
239
- matchCase = false;
240
- currentMatches = [];
241
- currentMatch;
242
- showAnnotationsToolbar = false;
243
- /**
244
- * @hidden
245
- */
246
- set enabledSelection(value) {
247
- if (this.pdfViewerWidget) {
248
- this.ngZone.runOutsideAngular(() => this.pdfViewerWidget.setInteractionMode({ mode: value ? PdfViewerInteractionMode.TextSelection : PdfViewerInteractionMode.Pan }));
249
- }
250
- this._enabledSelection = value;
251
- }
252
- /**
253
- * @hidden
254
- */
255
- get enabledSelection() {
256
- return this._enabledSelection;
257
- }
258
- /**
259
- * @hidden
260
- */
261
- onSetAnnotationMode(mode) {
262
- this.pdfViewerWidget?.resetAnnotationEditorMode();
263
- this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.TextSelection });
264
- this.pdfViewerWidget?.setAnnotationEditorMode({ mode: AnnotationEditorTypes[mode], interactionMode: PdfViewerInteractionMode.TextSelection });
265
- }
266
- /**
267
- * @hidden
268
- */
269
- showLicenseWatermark = false;
270
- /**
271
- * @hidden
272
- */
273
- licenseMessage;
274
- skip = 0;
275
- zoomOptionsData = zoomOptionsData;
276
- zoomLevel = this.zoomOptionsData[5];
277
- _pdfContext = null;
278
- _enabledSelection = false;
279
- _zoom = INITIAL_ZOOM_LEVEL;
280
- _fitType;
281
- _zoomToFit = false;
282
- subs = new Subscription();
283
- popupSub = new Subscription();
284
- emitLoad = true;
285
- pdfViewerWidget;
286
- constructor(ngZone, renderer, localizationService, cdr, host, popupService) {
287
- this.ngZone = ngZone;
288
- this.renderer = renderer;
289
- this.localizationService = localizationService;
290
- this.cdr = cdr;
291
- this.host = host;
292
- this.popupService = popupService;
293
- const isValid = validatePackage(packageMetadata);
294
- this.licenseMessage = getLicenseMessage(packageMetadata);
295
- this.showLicenseWatermark = shouldShowValidationUI(isValid);
296
- this.direction = localizationService.rtl ? 'rtl' : 'ltr';
297
- counter++;
298
- }
299
- ngOnInit() {
300
- this.subs.add(this.localizationService.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
301
- }
302
- ngOnDestroy() {
303
- this.subs.unsubscribe();
304
- this.popupSub?.unsubscribe();
305
- this.pdfViewerWidget?.destroy();
306
- this.pdfContext = null;
307
- this.observer?.disconnect();
308
- this.observer = null;
309
- }
310
- ngOnChanges(changes) {
311
- const newBase64Data = changes['data'] && this.data;
312
- const newUrl = changes['url'] && this.url;
313
- const newArrayBuffer = changes['arrayBuffer'] && this.arrayBuffer;
314
- const newTypedArray = changes['typedArray'] && this.typedArray;
315
- if (changes['renderForms']) {
316
- this.enabledSelection = this.renderForms;
317
- }
318
- this.verifySettings(changes);
319
- const dataOrTypedArray = newBase64Data ? 'data' : 'typedArray';
320
- const bufferOrDataOrTypedArray = newArrayBuffer ? 'arrayBuffer' : dataOrTypedArray;
321
- const source = newUrl ? 'url' : bufferOrDataOrTypedArray;
322
- if (newUrl || newArrayBuffer || newBase64Data || newTypedArray) {
323
- this.loadPdf(source, this[source]);
324
- }
325
- }
326
- /**
327
- * Scrolls the PDFViewer document to the specified page number, treating 0 as the first page
328
- * ([see example](slug:tools_pdfviewer#programmatically-scrolling-the-pdfviewer)).
329
- */
330
- scrollToPage(page) {
331
- this.pdfViewerWidget?.scrollToPage({ pageNumber: page });
332
- }
333
- /**
334
- * @hidden
335
- */
336
- messageFor(key) {
337
- return this.localizationService.get(key);
338
- }
339
- /**
340
- * @hidden
341
- */
342
- onFileSelect(e) {
343
- this.loadPdf('data', e);
344
- }
345
- /**
346
- * @hidden
347
- */
348
- onFileSelectError(e) {
349
- this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
350
- }
351
- /**
352
- * @hidden
353
- */
354
- onPageChange(e) {
355
- this.ngZone.runOutsideAngular(() => this.scrollToPage(e.skip + 1));
356
- }
357
- /**
358
- * @hidden
359
- */
360
- onPanningEnabled() {
361
- this.enabledSelection = false;
362
- this.showAnnotationsToolbar = false;
363
- this.ngZone.runOutsideAngular(() => {
364
- this.pdfViewerWidget?.resetAnnotationEditorMode();
365
- this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.Pan });
366
- });
367
- }
368
- /**
369
- * @hidden
370
- */
371
- onSelectionEnabled() {
372
- this.enabledSelection = true;
373
- this.ngZone.runOutsideAngular(() => {
374
- this.pdfViewerWidget?.resetAnnotationEditorMode();
375
- this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.TextSelection });
376
- });
377
- }
378
- /**
379
- * @hidden
380
- */
381
- onDownload() {
382
- if (!this.pdfContext?.pdfDoc) {
383
- this.zoneAwareEmitter('error', { error: 'No document to export.', context: this.pdfContext });
384
- return;
385
- }
386
- const downloadEvent = new PDFViewerDownloadEvent(this.saveFileName, this.saveOptions, this.pdfContext);
387
- this.zoneAwareEmitter('download', downloadEvent);
388
- if (!downloadEvent.isDefaultPrevented()) {
389
- this.ngZone.runOutsideAngular(() => this.pdfViewerWidget?.downloadFile({ fileName: this.saveFileName, saveOptions: this.saveOptions }));
390
- }
391
- }
392
- /**
393
- * @hidden
394
- */
395
- stopPropagation = (e) => {
396
- if (e.ctrlKey || e.metaKey) {
397
- e.preventDefault();
398
- }
399
- };
400
- /**
401
- * @hidden
402
- */
403
- onZoomIn() {
404
- const newZoom = Math.min(this.zoom + this.zoomRate, this.maxZoom);
405
- if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
406
- this.zoneAwareEmitter('zoomLevelChange', {
407
- previousZoomLevel: this.zoom,
408
- currentZoomLevel: newZoom
409
- });
410
- this.zoom = this.pdfContext.zoom = newZoom;
411
- }
412
- }
413
- /**
414
- * @hidden
415
- */
416
- onZoomOut() {
417
- const newZoom = Math.max(this.zoom - this.zoomRate, this.minZoom);
418
- if (newZoom !== this.zoom && this.pdfContext.pdfDoc) {
419
- this.zoneAwareEmitter('zoomLevelChange', {
420
- previousZoomLevel: this.zoom,
421
- currentZoomLevel: newZoom
422
- });
423
- this.zoom = this.pdfContext.zoom = newZoom;
424
- }
425
- }
426
- /**
427
- * @hidden
428
- */
429
- onZoomLevelChange(zoomLevel, emit = true) {
430
- if (!zoomLevel) {
431
- zoomLevel = {
432
- value: 1,
433
- displayValue: '100%',
434
- text: '100%'
435
- };
436
- }
437
- let newZoom = zoomLevel.type ? this.pdfViewerWidget?.calculateZoomLevel({
438
- zoomLevel: zoomLevel.value,
439
- zoomLevelType: zoomLevel.type,
440
- currentZoom: this.zoom
441
- }) : Math.min(Math.max(zoomLevel.value, this.minZoom), this.maxZoom);
442
- newZoom = Math.round((newZoom + Number.EPSILON) * 100) / 100;
443
- const sameZoom = this.zoom === newZoom;
444
- if (!sameZoom) {
445
- emit && this.zoneAwareEmitter('zoomLevelChange', {
446
- previousZoomLevel: this.zoom,
447
- currentZoomLevel: newZoom
448
- });
449
- this.zoom = this.pdfContext.zoom = newZoom;
450
- }
451
- else {
452
- this.setZoomLevel(newZoom, zoomLevel.type);
453
- }
454
- }
455
- /**
456
- * @hidden
457
- */
458
- onSearch() {
459
- this.searchActive = true;
460
- }
461
- /**
462
- * @hidden
463
- */
464
- onPrint() {
465
- this.loading = true;
466
- this.pdfViewerWidget?.printFile();
467
- }
468
- /**
469
- * @hidden
470
- */
471
- onSearchChange(e) {
472
- this.currentMatches = this.pdfViewerWidget.searchService.search({ ...e });
473
- this.currentMatch = this.currentMatches.length ? 1 : 0;
474
- }
475
- /**
476
- * @hidden
477
- */
478
- closeSearch(toolbar) {
479
- this.searchActive = false;
480
- this.pdfViewerWidget.searchService.destroy();
481
- this.currentMatches = [];
482
- this.currentMatch = null;
483
- toolbar.focus();
484
- }
485
- /**
486
- * @hidden
487
- */
488
- onNextMatch() {
489
- this.pdfViewerWidget?.goToNextSearchMatch();
490
- this.currentMatch = this.currentMatch + 1 > this.currentMatches.length ? 1 : this.currentMatch + 1;
491
- }
492
- /**
493
- * @hidden
494
- */
495
- onPreviousMatch() {
496
- this.pdfViewerWidget?.goToPreviousSearchMatch();
497
- this.currentMatch = this.currentMatch - 1 < 1 ? this.currentMatches.length : this.currentMatch - 1;
498
- }
499
- /**
500
- * @hidden
501
- */
502
- toggleAnnotationsToolbar() {
503
- this.showAnnotationsToolbar = !this.showAnnotationsToolbar;
504
- this.host.nativeElement.querySelector(`#${this.annotationsToolId}`)?.focus();
505
- if (!this.showAnnotationsToolbar) {
506
- this.pdfViewerWidget?.resetAnnotationEditorMode();
507
- }
508
- }
509
- loadPdf(dataType, data) {
510
- this.pdfViewerWidget?.destroy();
511
- this.loading = true;
512
- this.emitLoad = true;
513
- this.ngZone.runOutsideAngular(() => {
514
- // try to destroy if new dynamic data source
515
- this.pagesContainer && removeChildren(this.pagesContainer.nativeElement);
516
- const file = dataType === 'url' || dataType === 'data' ? { [dataType]: data } : { data };
517
- this.pdfViewerWidget = new PdfViewer(this.host.nativeElement, {
518
- loadOnDemand: this.loadOnDemand,
519
- loadOnDemandPageSize: this.loadOnDemandPageSize,
520
- zoomLevel: this.zoom,
521
- scaleFactor: 1,
522
- fileDescriptor: file,
523
- renderForms: this.renderForms,
524
- events: {
525
- pagesLoad: this.loadHandler,
526
- zoomStart: () => {
527
- this.skip = this.pdfViewerWidget.getCurrentPageIndex();
528
- },
529
- zoomEnd: this.zoomEndHandler,
530
- printEnd: () => {
531
- this.loading = false;
532
- },
533
- scroll: this.scrollHandler,
534
- error: this.errorHandler,
535
- annotationEditorToolBarShow: this.onAnnotationEditorToolBarShowHandler,
536
- annotationEditorToolBarHide: this.onAnnotationEditorToolBarHideHandler,
537
- }
538
- });
539
- });
540
- }
541
- assignPageIds() {
542
- this.pagesContainer.nativeElement.querySelectorAll('.k-page').forEach((pageElement, index) => {
543
- const id = `k-pdfviewer-${counter}-page-${index + 1}`;
544
- this.renderer.setAttribute(pageElement, 'id', id);
545
- });
546
- }
547
- setZoomLevel(zoom, type) {
548
- const option = this.zoomOptionsData.find(item => (!item.type && item.value === zoom) || (item.type && item.type === type));
549
- this.zoomLevel = structuredClone(option) ?? {
550
- value: zoom,
551
- displayValue: `${Math.round(zoom * 100)}%`,
552
- text: `${Math.round(zoom * 100)}%`
553
- };
554
- this.pdfViewerWidget?.zoom({ zoomLevel: zoom, zoomLevelType: type });
555
- }
556
- verifySettings(changes) {
557
- const sourceTypes = ['url', 'arrayBuffer', 'data', 'typedArray'];
558
- const setTypes = sourceTypes.map(item => this.isSet(changes, item)).filter(item => item);
559
- if (isDevMode() && setTypes.length > 1) {
560
- console.warn(`
561
- Setting more than one source of data simultaneously is not supported.
562
- Only one of 'url', 'arrayBuffer', 'data', or 'typedArray' can be set.
563
- `);
564
- }
565
- }
566
- isSet(changes, source) {
567
- return this[source] || changes[source]?.currentValue;
568
- }
569
- scrollHandler = (e) => {
570
- const currentPage = this.currentPage;
571
- this.skip = e.pageNumber - 1;
572
- this.cdr.markForCheck();
573
- if (e.isPageChanged) {
574
- this.zoneAwareEmitter('pageChange', {
575
- previousPage: currentPage,
576
- currentPage: e.pageNumber
577
- });
578
- }
579
- };
580
- loadHandler = (e) => {
581
- if (!this.pdfContext) {
582
- this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
583
- }
584
- this.pdfViewerWidget.setInteractionMode({ mode: this.enabledSelection ? PdfViewerInteractionMode.TextSelection : PdfViewerInteractionMode.Pan });
585
- if (!this._zoomToFit) {
586
- this.pdfContext = { ...e, element: this.pagesContainer.nativeElement, zoom: e.sender.state.zoomLevel };
587
- if (this.emitLoad) {
588
- this.zoneAwareEmitter('load', { context: this.pdfContext });
589
- this.emitLoad = false;
590
- }
591
- }
592
- else {
593
- const zoomLevelOption = this.zoomOptionsData.find(item => item.type === this._fitType);
594
- this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
595
- this.onZoomLevelChange(zoomLevelOption, false);
596
- }
597
- this.pdfViewerWidget.activatePageNumber(1);
598
- this.cdr.markForCheck();
599
- this.assignPageIds();
600
- this.ngZone.run(() => this.loading = false);
601
- };
602
- zoomEndHandler = (e) => {
603
- const zoom = Math.round(Math.min(Math.max(e.zoomLevel, this.minZoom), this.maxZoom) * 100) / 100;
604
- this.zoneAwareEmitter('zoomLevelChange', {
605
- currentZoomLevel: zoom,
606
- previousZoomLevel: this.zoom
607
- });
608
- this.zoom = zoom;
609
- };
610
- errorHandler = (e) => {
611
- this.ngZone.run(() => this.loading = false);
612
- this.pdfContext = null;
613
- this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
614
- };
615
- annotationPopup = null;
616
- observer;
617
- onAnnotationEditorToolBarShowHandler = (e) => {
618
- this.cdr.markForCheck();
619
- this.observer?.disconnect();
620
- const type = e.annotationEditorMode;
621
- const anchor = e.anchor;
622
- const editor = e.source.firstSelectedEditor;
623
- const popup = this.annotationPopup?.popup;
624
- // Do not continue if popup is already visible for this annotation.
625
- if (popup && popup.instance.anchor === anchor && type === "freeText") {
626
- return;
627
- }
628
- if (this.annotationPopup) {
629
- this.annotationPopup.close();
630
- this.annotationPopup = null;
631
- }
632
- this.annotationPopup = this.popupService.open({
633
- anchor: anchor,
634
- appendTo: this.pagesContainerViewContainerRef,
635
- content: AnnotationPopupToolbarContentComponent,
636
- popupClass: 'k-pdfviewer-annotation-popup',
637
- });
638
- const annotationToolbarInstance = this.annotationPopup.content.instance;
639
- annotationToolbarInstance.localizationService = this.localizationService;
640
- annotationToolbarInstance.annotationEditorType = type;
641
- annotationToolbarInstance.pdfViewerWidget = this.pdfViewerWidget;
642
- annotationToolbarInstance.anchor = anchor;
643
- annotationToolbarInstance.popupRef = this.annotationPopup;
644
- annotationToolbarInstance.initialColor = editor?.color;
645
- annotationToolbarInstance.initialFontSize = editor.propertiesToUpdate[0][1];
646
- annotationToolbarInstance.dialogContainer = this.dialogContainerViewContainerRef;
647
- annotationToolbarInstance.removeAnnotationConfirmation = this.removeAnnotationConfirmation;
648
- this.popupSub = this.annotationPopup.popup.instance.anchorViewportLeave.subscribe(() => {
649
- this.ngZone.run(() => this.annotationPopup?.close());
650
- this.annotationPopup = null;
651
- this.popupSub?.unsubscribe();
652
- this.popupSub = null;
653
- });
654
- this.ngZone.runOutsideAngular(() => {
655
- this.observer = this.classMutationObserver(anchor, 'k-selected', () => {
656
- this.ngZone.run(() => this.annotationPopup?.close());
657
- });
658
- });
659
- };
660
- onAnnotationEditorToolBarHideHandler = () => {
661
- this.cdr.markForCheck();
662
- if (this.annotationPopup?.popup) {
663
- this.annotationPopup.close();
664
- this.annotationPopup = null;
665
- }
666
- };
667
- zoneAwareEmitter = (eventName, eventData) => {
668
- if (hasObservers(this[eventName])) {
669
- this.ngZone.run(() => this[eventName].emit(eventData));
670
- }
671
- };
672
- classMutationObserver = (element, className, callback) => {
673
- const observer = new MutationObserver((m) => {
674
- m.forEach(() => {
675
- callback();
676
- });
677
- });
678
- observer.observe(element, { attributeFilter: ['class'] });
679
- return observer;
680
- };
681
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PDFViewerComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i2.PopupService }], target: i0.ɵɵFactoryTarget.Component });
682
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: PDFViewerComponent, isStandalone: true, selector: "kendo-pdfviewer", inputs: { tools: "tools", loaderSettings: "loaderSettings", renderForms: "renderForms", saveFileName: "saveFileName", saveOptions: "saveOptions", url: "url", data: "data", arrayBuffer: "arrayBuffer", typedArray: "typedArray", zoom: "zoom", zoomRate: "zoomRate", minZoom: "minZoom", maxZoom: "maxZoom", loadOnDemand: "loadOnDemand", loadOnDemandPageSize: "loadOnDemandPageSize", removeAnnotationConfirmation: "removeAnnotationConfirmation" }, outputs: { load: "load", error: "error", download: "download", pageChange: "pageChange", zoomLevelChange: "zoomLevelChange" }, host: { properties: { "class.k-pdf-viewer": "this.hostClass", "attr.dir": "this.direction", "attr.display": "this.display" } }, providers: [
683
- LocalizationService,
684
- {
685
- provide: L10N_PREFIX,
686
- useValue: 'kendo.pdfviewer'
687
- }
688
- ], viewQueries: [{ propertyName: "pagesContainer", first: true, predicate: ["pagesContainer"], descendants: true }, { propertyName: "pagesContainerViewContainerRef", first: true, predicate: ["pagesContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "dialogContainerViewContainerRef", first: true, predicate: ["dialogContainer"], descendants: true, read: ViewContainerRef }], exportAs: ["kendo-pdfviewer"], usesOnChanges: true, ngImport: i0, template: `
689
- <ng-container kendoPDFViewerLocalizedMessages
690
- i18n-pagerFirstPage="kendo.pdfviewer.pagerFirstPage|The label for the first page button in the Pager"
691
- pagerFirstPage="Go to the first page"
692
-
693
- i18n-pagerPreviousPage="kendo.pdfviewer.pagerPreviousPage|The label for the previous page button in the Pager"
694
- pagerPreviousPage="Go to the previous page"
695
-
696
- i18n-pagerNextPage="kendo.pdfviewer.pagerNextPage|The label for the next page button in the Pager"
697
- pagerNextPage="Go to the next page"
698
-
699
- i18n-pagerLastPage="kendo.pdfviewer.pagerLastPage|The label for the last page button in the Pager"
700
- pagerLastPage="Go to the last page"
701
-
702
- i18n-pagerPage="kendo.pdfviewer.pagerPage|The text before the current page number in the Pager"
703
- pagerPage="Page"
704
-
705
- i18n-pagerOf="kendo.pdfviewer.pagerOf|The text before the total pages number in the Pager"
706
- pagerOf="of"
707
-
708
- i18n-pagerInputTitle="kendo.pdfviewer.pagerInputTitle|The label of the pager input element"
709
- pagerInputTitle="Page Number"
710
-
711
- i18n-pagerInputLabel="kendo.pdfviewer.pagerInputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
712
- pagerInputLabel="Type a page number"
713
-
714
- i18n-zoomInTitle="kendo.pdfviewer.zoomInTitle|The ZoomIn tool title and label."
715
- zoomInTitle="Zoom in"
716
-
717
- i18n-zoomOutTitle="kendo.pdfviewer.zoomOutTitle|The ZoomOut tool title and label."
718
- zoomOutTitle="Zoom out"
719
-
720
- i18n-selectionTitle="kendo.pdfviewer.selectionTitle|The Selection tool title and label."
721
- selectionTitle="Enable selection"
722
-
723
- i18n-panningTitle="kendo.pdfviewer.panningTitle|The Panning tool title and label."
724
- panningTitle="Enable panning"
725
-
726
- i18n-searchTitle="kendo.pdfviewer.searchTitle|The Search tool title and label."
727
- searchTitle="Search"
728
-
729
- i18n-openTitle="kendo.pdfviewer.openTitle|The Open tool title and label."
730
- openTitle="Open"
731
-
732
- i18n-downloadTitle="kendo.pdfviewer.downloadTitle|The Download tool title and label."
733
- downloadTitle="Download"
734
-
735
- i18n-printTitle="kendo.pdfviewer.printTitle|The Print tool title and label."
736
- printTitle="Print"
737
-
738
- i18n-fitToPage="kendo.pdfviewer.fitToPage|The text for the zoom level chooser Fit to page option."
739
- fitToPage="Fit to page"
740
-
741
- i18n-fitToWidth="kendo.pdfviewer.fitToWidth|The text for the zoom level chooser Fit to width option."
742
- fitToWidth="Fit to width"
743
-
744
- i18n-searchInputPlaceholder="kendo.pdfviewer.searchInputPlaceholder|The text for the search input placeholder."
745
- searchInputPlaceholder="Search"
746
-
747
- i18n-searchMatchesOf="kendo.pdfviewer.searchMatchesOf|The text before the total number of matches in the Search tool."
748
- searchMatchesOf="of"
749
-
750
- i18n-searchPreviousMatchTitle="kendo.pdfviewer.searchPreviousMatchTitle|The title of the Search tool previous match button."
751
- searchPreviousMatchTitle="Previous match"
752
-
753
- i18n-searchNextMatchTitle="kendo.pdfviewer.searchNextMatchTitle|The title of the Search tool next match button."
754
- searchNextMatchTitle="Next match"
755
-
756
- i18n-searchCloseTitle="kendo.pdfviewer.searchCloseTitle|The title of the Search tool close button."
757
- searchCloseTitle="Close"
758
-
759
- i18n-searchMatchCaseTitle="kendo.pdfviewer.searchMatchCaseTitle|The title of the Search tool match case button."
760
- searchMatchCaseTitle="Match case"
761
-
762
- i18n-zoomInputPlaceholder="kendo.pdfviewer.zoomInputPlaceholder|The text for the zoom tool input placeholder."
763
- zoomInputPlaceholder="Choose zoom level"
764
-
765
- i18n-annotationsTitle="kendo.pdfviewer.annotationsTitle|The Annotations tool title and label."
766
- annotationsTitle="Annotations"
767
-
768
- i18n-annotationEditorTitle="kendo.pdfviewer.annotationEditorTitle|The annotation editor tool title and label."
769
- annotationEditorTitle="Annotation editor"
770
-
771
- i18n-deleteAnnotationTitle="kendo.pdfviewer.deleteAnnotationTitle|The delete annotation tool title and label."
772
- deleteAnnotationTitle="Delete annotation"
773
-
774
- i18n-highlightAnnotationTitle="kendo.pdfviewer.highlightAnnotationTitle|The highlight annotation tool title and label."
775
- highlightAnnotationTitle="Highlight"
776
-
777
- i18n-freeTextAnnotationTitle="kendo.pdfviewer.freeTextAnnotationTitle|The free text annotation tool title and label."
778
- freeTextAnnotationTitle="Free text"
779
-
780
- i18n-closeAnnotationsToolbarTitle="kendo.pdfviewer.closeAnnotationsToolbarTitle|The close annotations toolbar tool title and label."
781
- closeAnnotationsToolbarTitle="Close"
782
-
783
- i18n-deleteAnnotationConfirmationDialogTitle="kendo.pdfviewer.deleteAnnotationConfirmationDialogTitle|The delete annotation confirmation dialog title."
784
- deleteAnnotationConfirmationDialogTitle="Delete annotation"
785
-
786
- i18n-deleteAnnotationConfirmationDialogContent="kendo.pdfviewer.deleteAnnotationConfirmationDialogContent|The delete annotation confirmation dialog content."
787
- deleteAnnotationConfirmationDialogContent="Are you sure you want to delete this annotation?"
788
-
789
- i18n-deleteAnnotationConfirmationDialogConfirmText="kendo.pdfviewer.deleteAnnotationConfirmationDialogConfirmText|The delete annotation confirmation dialog confirm button text."
790
- deleteAnnotationConfirmationDialogConfirmText="Delete"
791
-
792
- i18n-deleteAnnotationConfirmationDialogRejectText="kendo.pdfviewer.deleteAnnotationConfirmationDialogRejectText|The delete annotation confirmation dialog reject button text."
793
- deleteAnnotationConfirmationDialogRejectText="Cancel"
794
-
795
- i18n-annotationEditorFontSizeTitle="kendo.pdfviewer.annotationEditorFontSizeTitle|The annotation editor font size section title."
796
- annotationEditorFontSizeTitle="Font size"
797
-
798
- i18n-annotationEditorColorTitle="kendo.pdfviewer.annotationEditorColorTitle|The annotation editor color section title."
799
- annotationEditorColorTitle="Color"
800
-
801
- i18n-canvasLabel="kendo.pdfviewer.canvasLabel|The label for the PDF viewer canvas container."
802
- canvasLabel="PDF document">
803
- </ng-container>
804
- @if (loading) {
805
- <div kendoPDFViewerLoader
806
- [settings]="loaderSettings"></div>
807
- }
808
- <div kendoPDFViewerToolbar
809
- #toolbar
810
- role="toolbar"
811
- [attr.aria-controls]="pagesContainerId"
812
- [tools]="tools"
813
- [skip]="skip"
814
- [total]="pdfContext?.pdfPages.length ? pdfContext?.pdfPages.length : 1"
815
- [pageSize]="1"
816
- [zoomInDisabled]="zoom >= maxZoom || !pdfContext?.pdfDoc"
817
- [zoomOutDisabled]="zoom <= minZoom || !pdfContext?.pdfDoc"
818
- [zoomOptionsData]="zoomOptionsData"
819
- [zoomLevelChooserValue]="zoomLevel"
820
- [disabledTools]="!pdfContext?.pdfDoc"
821
- [isAnnotationsToolbarVisible]="showAnnotationsToolbar"
822
- [wrapperId]="showAnnotationsToolbar ? annotationsToolbarId : undefined"
823
- [annotationsToolId]="annotationsToolId"
824
- [isSelectionEnabled]="enabledSelection"
825
- (pageChange)="onPageChange($event)"
826
- (fileSelect)="onFileSelect($event)"
827
- (fileSelectStart)="loading = true;"
828
- (fileSelectError)="onFileSelectError($event)"
829
- (download)="onDownload()"
830
- (panningEnabled)="onPanningEnabled();"
831
- (selectionEnabled)="onSelectionEnabled();"
832
- (zoomIn)="onZoomIn()"
833
- (zoomOut)="onZoomOut()"
834
- (zoomLevelChange)="onZoomLevelChange($event)"
835
- (print)="onPrint()"
836
- (search)="onSearch()"
837
- (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
838
- @if (showAnnotationsToolbar) {
839
- <div
840
- [attr.id]="annotationsToolbarId"
841
- kendoPDFViewerToolbar
842
- role="toolbar"
843
- type="annotations"
844
- (setAnnotationMode)="onSetAnnotationMode($event)"
845
- [attr.aria-controls]="pagesContainerId"
846
- [disabledTools]="!pdfContext?.pdfDoc"
847
- (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
848
- }
849
- <div
850
- class="k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto"
851
- [class.k-enable-text-select]="enabledSelection"
852
- [class.k-enable-panning]="!enabledSelection"
853
- [attr.aria-describedby]="activePageId"
854
- [attr.aria-label]="messageFor('canvasLabel')"
855
- role="document"
856
- tabindex="0">
857
- @if (searchActive) {
858
- <div
859
- kendoPDFViewerSearch
860
- [currentMatch]="currentMatch"
861
- [matches]="currentMatches.length"
862
- class="k-search-panel k-pos-sticky k-top-center"
863
- (searchChange)="onSearchChange($event)"
864
- (prevMatch)="onPreviousMatch()"
865
- (nextMatch)="onNextMatch()"
866
- (close)="closeSearch(toolbar)"></div>
867
- }
868
- <div
869
- #pagesContainer
870
- [kendoEventsOutsideAngular]="{
871
- wheel: stopPropagation
872
- }"
873
- class="k-pdf-viewer-pages"
874
- [attr.id]="pagesContainerId"></div>
875
- </div>
876
-
877
- <div #dialogContainer></div>
878
- @if (showLicenseWatermark) {
879
- <div kendoWatermarkOverlay [licenseMessage]="licenseMessage"></div>
880
- }
881
- `, isInline: true, dependencies: [{ kind: "directive", type: LocalizedPDFViewerMessagesDirective, selector: "[kendoPDFViewerLocalizedMessages]" }, { 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", "type", "wrapperId", "isAnnotationsToolbarVisible", "annotationsToolId", "isSelectionEnabled"], outputs: ["fileSelect", "fileSelectStart", "fileSelectError", "download", "selectionEnabled", "panningEnabled", "pageChange", "zoomIn", "zoomOut", "zoomLevelChange", "print", "search", "toggleAnnotationsToolbar", "setAnnotationMode"] }, { kind: "component", type: PDFViewerSearchComponent, selector: "[kendoPDFViewerSearch]", inputs: ["matches", "currentMatch"], outputs: ["searchChange", "prevMatch", "nextMatch", "close"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }] });
882
- }
883
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PDFViewerComponent, decorators: [{
884
- type: Component,
885
- args: [{
886
- exportAs: 'kendo-pdfviewer',
887
- selector: 'kendo-pdfviewer',
888
- providers: [
889
- LocalizationService,
890
- {
891
- provide: L10N_PREFIX,
892
- useValue: 'kendo.pdfviewer'
893
- }
894
- ],
895
- template: `
896
- <ng-container kendoPDFViewerLocalizedMessages
897
- i18n-pagerFirstPage="kendo.pdfviewer.pagerFirstPage|The label for the first page button in the Pager"
898
- pagerFirstPage="Go to the first page"
899
-
900
- i18n-pagerPreviousPage="kendo.pdfviewer.pagerPreviousPage|The label for the previous page button in the Pager"
901
- pagerPreviousPage="Go to the previous page"
902
-
903
- i18n-pagerNextPage="kendo.pdfviewer.pagerNextPage|The label for the next page button in the Pager"
904
- pagerNextPage="Go to the next page"
905
-
906
- i18n-pagerLastPage="kendo.pdfviewer.pagerLastPage|The label for the last page button in the Pager"
907
- pagerLastPage="Go to the last page"
908
-
909
- i18n-pagerPage="kendo.pdfviewer.pagerPage|The text before the current page number in the Pager"
910
- pagerPage="Page"
911
-
912
- i18n-pagerOf="kendo.pdfviewer.pagerOf|The text before the total pages number in the Pager"
913
- pagerOf="of"
914
-
915
- i18n-pagerInputTitle="kendo.pdfviewer.pagerInputTitle|The label of the pager input element"
916
- pagerInputTitle="Page Number"
917
-
918
- i18n-pagerInputLabel="kendo.pdfviewer.pagerInputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
919
- pagerInputLabel="Type a page number"
920
-
921
- i18n-zoomInTitle="kendo.pdfviewer.zoomInTitle|The ZoomIn tool title and label."
922
- zoomInTitle="Zoom in"
923
-
924
- i18n-zoomOutTitle="kendo.pdfviewer.zoomOutTitle|The ZoomOut tool title and label."
925
- zoomOutTitle="Zoom out"
926
-
927
- i18n-selectionTitle="kendo.pdfviewer.selectionTitle|The Selection tool title and label."
928
- selectionTitle="Enable selection"
929
-
930
- i18n-panningTitle="kendo.pdfviewer.panningTitle|The Panning tool title and label."
931
- panningTitle="Enable panning"
932
-
933
- i18n-searchTitle="kendo.pdfviewer.searchTitle|The Search tool title and label."
934
- searchTitle="Search"
935
-
936
- i18n-openTitle="kendo.pdfviewer.openTitle|The Open tool title and label."
937
- openTitle="Open"
938
-
939
- i18n-downloadTitle="kendo.pdfviewer.downloadTitle|The Download tool title and label."
940
- downloadTitle="Download"
941
-
942
- i18n-printTitle="kendo.pdfviewer.printTitle|The Print tool title and label."
943
- printTitle="Print"
944
-
945
- i18n-fitToPage="kendo.pdfviewer.fitToPage|The text for the zoom level chooser Fit to page option."
946
- fitToPage="Fit to page"
947
-
948
- i18n-fitToWidth="kendo.pdfviewer.fitToWidth|The text for the zoom level chooser Fit to width option."
949
- fitToWidth="Fit to width"
950
-
951
- i18n-searchInputPlaceholder="kendo.pdfviewer.searchInputPlaceholder|The text for the search input placeholder."
952
- searchInputPlaceholder="Search"
953
-
954
- i18n-searchMatchesOf="kendo.pdfviewer.searchMatchesOf|The text before the total number of matches in the Search tool."
955
- searchMatchesOf="of"
956
-
957
- i18n-searchPreviousMatchTitle="kendo.pdfviewer.searchPreviousMatchTitle|The title of the Search tool previous match button."
958
- searchPreviousMatchTitle="Previous match"
959
-
960
- i18n-searchNextMatchTitle="kendo.pdfviewer.searchNextMatchTitle|The title of the Search tool next match button."
961
- searchNextMatchTitle="Next match"
962
-
963
- i18n-searchCloseTitle="kendo.pdfviewer.searchCloseTitle|The title of the Search tool close button."
964
- searchCloseTitle="Close"
965
-
966
- i18n-searchMatchCaseTitle="kendo.pdfviewer.searchMatchCaseTitle|The title of the Search tool match case button."
967
- searchMatchCaseTitle="Match case"
968
-
969
- i18n-zoomInputPlaceholder="kendo.pdfviewer.zoomInputPlaceholder|The text for the zoom tool input placeholder."
970
- zoomInputPlaceholder="Choose zoom level"
971
-
972
- i18n-annotationsTitle="kendo.pdfviewer.annotationsTitle|The Annotations tool title and label."
973
- annotationsTitle="Annotations"
974
-
975
- i18n-annotationEditorTitle="kendo.pdfviewer.annotationEditorTitle|The annotation editor tool title and label."
976
- annotationEditorTitle="Annotation editor"
977
-
978
- i18n-deleteAnnotationTitle="kendo.pdfviewer.deleteAnnotationTitle|The delete annotation tool title and label."
979
- deleteAnnotationTitle="Delete annotation"
980
-
981
- i18n-highlightAnnotationTitle="kendo.pdfviewer.highlightAnnotationTitle|The highlight annotation tool title and label."
982
- highlightAnnotationTitle="Highlight"
983
-
984
- i18n-freeTextAnnotationTitle="kendo.pdfviewer.freeTextAnnotationTitle|The free text annotation tool title and label."
985
- freeTextAnnotationTitle="Free text"
986
-
987
- i18n-closeAnnotationsToolbarTitle="kendo.pdfviewer.closeAnnotationsToolbarTitle|The close annotations toolbar tool title and label."
988
- closeAnnotationsToolbarTitle="Close"
989
-
990
- i18n-deleteAnnotationConfirmationDialogTitle="kendo.pdfviewer.deleteAnnotationConfirmationDialogTitle|The delete annotation confirmation dialog title."
991
- deleteAnnotationConfirmationDialogTitle="Delete annotation"
992
-
993
- i18n-deleteAnnotationConfirmationDialogContent="kendo.pdfviewer.deleteAnnotationConfirmationDialogContent|The delete annotation confirmation dialog content."
994
- deleteAnnotationConfirmationDialogContent="Are you sure you want to delete this annotation?"
995
-
996
- i18n-deleteAnnotationConfirmationDialogConfirmText="kendo.pdfviewer.deleteAnnotationConfirmationDialogConfirmText|The delete annotation confirmation dialog confirm button text."
997
- deleteAnnotationConfirmationDialogConfirmText="Delete"
998
-
999
- i18n-deleteAnnotationConfirmationDialogRejectText="kendo.pdfviewer.deleteAnnotationConfirmationDialogRejectText|The delete annotation confirmation dialog reject button text."
1000
- deleteAnnotationConfirmationDialogRejectText="Cancel"
1001
-
1002
- i18n-annotationEditorFontSizeTitle="kendo.pdfviewer.annotationEditorFontSizeTitle|The annotation editor font size section title."
1003
- annotationEditorFontSizeTitle="Font size"
1004
-
1005
- i18n-annotationEditorColorTitle="kendo.pdfviewer.annotationEditorColorTitle|The annotation editor color section title."
1006
- annotationEditorColorTitle="Color"
1007
-
1008
- i18n-canvasLabel="kendo.pdfviewer.canvasLabel|The label for the PDF viewer canvas container."
1009
- canvasLabel="PDF document">
1010
- </ng-container>
1011
- @if (loading) {
1012
- <div kendoPDFViewerLoader
1013
- [settings]="loaderSettings"></div>
1014
- }
1015
- <div kendoPDFViewerToolbar
1016
- #toolbar
1017
- role="toolbar"
1018
- [attr.aria-controls]="pagesContainerId"
1019
- [tools]="tools"
1020
- [skip]="skip"
1021
- [total]="pdfContext?.pdfPages.length ? pdfContext?.pdfPages.length : 1"
1022
- [pageSize]="1"
1023
- [zoomInDisabled]="zoom >= maxZoom || !pdfContext?.pdfDoc"
1024
- [zoomOutDisabled]="zoom <= minZoom || !pdfContext?.pdfDoc"
1025
- [zoomOptionsData]="zoomOptionsData"
1026
- [zoomLevelChooserValue]="zoomLevel"
1027
- [disabledTools]="!pdfContext?.pdfDoc"
1028
- [isAnnotationsToolbarVisible]="showAnnotationsToolbar"
1029
- [wrapperId]="showAnnotationsToolbar ? annotationsToolbarId : undefined"
1030
- [annotationsToolId]="annotationsToolId"
1031
- [isSelectionEnabled]="enabledSelection"
1032
- (pageChange)="onPageChange($event)"
1033
- (fileSelect)="onFileSelect($event)"
1034
- (fileSelectStart)="loading = true;"
1035
- (fileSelectError)="onFileSelectError($event)"
1036
- (download)="onDownload()"
1037
- (panningEnabled)="onPanningEnabled();"
1038
- (selectionEnabled)="onSelectionEnabled();"
1039
- (zoomIn)="onZoomIn()"
1040
- (zoomOut)="onZoomOut()"
1041
- (zoomLevelChange)="onZoomLevelChange($event)"
1042
- (print)="onPrint()"
1043
- (search)="onSearch()"
1044
- (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
1045
- @if (showAnnotationsToolbar) {
1046
- <div
1047
- [attr.id]="annotationsToolbarId"
1048
- kendoPDFViewerToolbar
1049
- role="toolbar"
1050
- type="annotations"
1051
- (setAnnotationMode)="onSetAnnotationMode($event)"
1052
- [attr.aria-controls]="pagesContainerId"
1053
- [disabledTools]="!pdfContext?.pdfDoc"
1054
- (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
1055
- }
1056
- <div
1057
- class="k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto"
1058
- [class.k-enable-text-select]="enabledSelection"
1059
- [class.k-enable-panning]="!enabledSelection"
1060
- [attr.aria-describedby]="activePageId"
1061
- [attr.aria-label]="messageFor('canvasLabel')"
1062
- role="document"
1063
- tabindex="0">
1064
- @if (searchActive) {
1065
- <div
1066
- kendoPDFViewerSearch
1067
- [currentMatch]="currentMatch"
1068
- [matches]="currentMatches.length"
1069
- class="k-search-panel k-pos-sticky k-top-center"
1070
- (searchChange)="onSearchChange($event)"
1071
- (prevMatch)="onPreviousMatch()"
1072
- (nextMatch)="onNextMatch()"
1073
- (close)="closeSearch(toolbar)"></div>
1074
- }
1075
- <div
1076
- #pagesContainer
1077
- [kendoEventsOutsideAngular]="{
1078
- wheel: stopPropagation
1079
- }"
1080
- class="k-pdf-viewer-pages"
1081
- [attr.id]="pagesContainerId"></div>
1082
- </div>
1083
-
1084
- <div #dialogContainer></div>
1085
- @if (showLicenseWatermark) {
1086
- <div kendoWatermarkOverlay [licenseMessage]="licenseMessage"></div>
1087
- }
1088
- `,
1089
- standalone: true,
1090
- imports: [LocalizedPDFViewerMessagesDirective, EventsOutsideAngularDirective, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
1091
- }]
1092
- }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i2.PopupService }], propDecorators: { hostClass: [{
1093
- type: HostBinding,
1094
- args: ['class.k-pdf-viewer']
1095
- }], direction: [{
1096
- type: HostBinding,
1097
- args: ['attr.dir']
1098
- }], display: [{
1099
- type: HostBinding,
1100
- args: ['attr.display']
1101
- }], tools: [{
1102
- type: Input
1103
- }], loaderSettings: [{
1104
- type: Input
1105
- }], renderForms: [{
1106
- type: Input
1107
- }], saveFileName: [{
1108
- type: Input
1109
- }], saveOptions: [{
1110
- type: Input
1111
- }], url: [{
1112
- type: Input
1113
- }], data: [{
1114
- type: Input
1115
- }], arrayBuffer: [{
1116
- type: Input
1117
- }], typedArray: [{
1118
- type: Input
1119
- }], zoom: [{
1120
- type: Input
1121
- }], zoomRate: [{
1122
- type: Input
1123
- }], minZoom: [{
1124
- type: Input
1125
- }], maxZoom: [{
1126
- type: Input
1127
- }], loadOnDemand: [{
1128
- type: Input
1129
- }], loadOnDemandPageSize: [{
1130
- type: Input
1131
- }], removeAnnotationConfirmation: [{
1132
- type: Input
1133
- }], load: [{
1134
- type: Output
1135
- }], error: [{
1136
- type: Output
1137
- }], download: [{
1138
- type: Output
1139
- }], pageChange: [{
1140
- type: Output
1141
- }], zoomLevelChange: [{
1142
- type: Output
1143
- }], pagesContainer: [{
1144
- type: ViewChild,
1145
- args: ['pagesContainer']
1146
- }], pagesContainerViewContainerRef: [{
1147
- type: ViewChild,
1148
- args: ['pagesContainer', { read: ViewContainerRef }]
1149
- }], dialogContainerViewContainerRef: [{
1150
- type: ViewChild,
1151
- args: ['dialogContainer', { read: ViewContainerRef }]
1152
- }] } });