@progress/kendo-angular-pdfviewer 19.3.0-develop.8 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,15 +2,14 @@
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 { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, ViewChild, isDevMode } from '@angular/core';
5
+ import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, ViewChild, ViewContainerRef, isDevMode } from '@angular/core';
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 { PdfViewer, removeChildren, } from '@progress/kendo-pdfviewer-common';
10
- import { EventsOutsideAngularDirective, hasObservers, shouldShowValidationUI, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
9
+ import { PdfViewer, removeChildren, PdfViewerInteractionMode, } from '@progress/kendo-pdfviewer-common';
10
+ import { EventsOutsideAngularDirective, hasObservers, shouldShowValidationUI, getLicenseMessage, 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
- import { saveAs } from '@progress/kendo-file-saver';
14
13
  import { Subscription } from 'rxjs';
15
14
  import { ToolbarComponent } from './toolbar/toolbar.component';
16
15
  import { PDFViewerSearchComponent } from './toolbar/search.component';
@@ -18,8 +17,12 @@ import { LoaderComponent } from './loader/loader.component';
18
17
  import { NgIf } from '@angular/common';
19
18
  import { LocalizedPDFViewerMessagesDirective } from './localization/localized-messages.directive';
20
19
  import 'pdfjs-dist/build/pdf.worker.min.mjs';
20
+ import { AnnotationEditorTypes } from './models/annotation-editor.type';
21
+ import { PopupService } from '@progress/kendo-angular-popup';
22
+ import { AnnotationPopupToolbarContentComponent } from './annotations/annotation-editor';
21
23
  import * as i0 from "@angular/core";
22
24
  import * as i1 from "@progress/kendo-angular-l10n";
25
+ import * as i2 from "@progress/kendo-angular-popup";
23
26
  let counter = 0;
24
27
  /**
25
28
  * Represents the [Kendo UI PDFViewer component for Angular](slug:overview_pdfviewer).
@@ -42,11 +45,13 @@ export class PDFViewerComponent {
42
45
  localizationService;
43
46
  cdr;
44
47
  host;
48
+ popupService;
45
49
  hostClass = true;
46
50
  direction;
51
+ display = 'flex';
47
52
  /**
48
53
  * Represents the tools collection rendered in the toolbar.
49
- * @default ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print' ]
54
+ * @default ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print', 'annotations' ]
50
55
  */
51
56
  tools = [
52
57
  'pager',
@@ -58,7 +63,8 @@ export class PDFViewerComponent {
58
63
  'search',
59
64
  'open',
60
65
  'download',
61
- 'print'
66
+ 'print',
67
+ 'annotations'
62
68
  ];
63
69
  /**
64
70
  * The configuration of the internal Loader component.
@@ -143,6 +149,12 @@ export class PDFViewerComponent {
143
149
  * @default 1
144
150
  */
145
151
  loadOnDemandPageSize = 1;
152
+ /**
153
+ * Determines whether a confirmation dialog is shown when the user tries to delete an annotation.
154
+ *
155
+ * @default true
156
+ */
157
+ removeAnnotationConfirmation = true;
146
158
  /**
147
159
  * Fires when the component loads a PDF document successfully.
148
160
  */
@@ -164,6 +176,8 @@ export class PDFViewerComponent {
164
176
  */
165
177
  zoomLevelChange = new EventEmitter();
166
178
  pagesContainer;
179
+ pagesContainerViewContainerRef;
180
+ dialogContainerViewContainerRef;
167
181
  /**
168
182
  * Returns the current page number of the loaded PDF document.
169
183
  */
@@ -198,17 +212,30 @@ export class PDFViewerComponent {
198
212
  }
199
213
  return `k-pdfviewer-${counter}-pages-container`;
200
214
  }
215
+ /**
216
+ * @hidden
217
+ */
218
+ get annotationsToolbarId() {
219
+ return `k-pdfviewer-${counter}-annotations-toolbar`;
220
+ }
221
+ /**
222
+ * @hidden
223
+ */
224
+ get annotationsToolId() {
225
+ return `k-pdfviewer-${counter}-annotations-button`;
226
+ }
201
227
  loading = false;
202
228
  searchActive = false;
203
229
  matchCase = false;
204
230
  currentMatches = [];
205
231
  currentMatch;
232
+ showAnnotationsToolbar = false;
206
233
  /**
207
234
  * @hidden
208
235
  */
209
236
  set enabledSelection(value) {
210
237
  if (this.pdfViewerWidget) {
211
- value ? this.pdfViewerWidget.documentScroller.disablePanEventsTracking() : this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
238
+ this.ngZone.runOutsideAngular(() => this.pdfViewerWidget.setInteractionMode({ mode: value ? PdfViewerInteractionMode.TextSelection : PdfViewerInteractionMode.Pan }));
212
239
  }
213
240
  this._enabledSelection = value;
214
241
  }
@@ -218,10 +245,22 @@ export class PDFViewerComponent {
218
245
  get enabledSelection() {
219
246
  return this._enabledSelection;
220
247
  }
248
+ /**
249
+ * @hidden
250
+ */
251
+ onSetAnnotationMode(mode) {
252
+ this.pdfViewerWidget?.resetAnnotationEditorMode();
253
+ this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.TextSelection });
254
+ this.pdfViewerWidget?.setAnnotationEditorMode({ mode: AnnotationEditorTypes[mode], interactionMode: PdfViewerInteractionMode.TextSelection });
255
+ }
221
256
  /**
222
257
  * @hidden
223
258
  */
224
259
  showLicenseWatermark = false;
260
+ /**
261
+ * @hidden
262
+ */
263
+ licenseMessage;
225
264
  skip = 0;
226
265
  zoomOptionsData = zoomOptionsData;
227
266
  zoomLevel = this.zoomOptionsData[5];
@@ -231,14 +270,18 @@ export class PDFViewerComponent {
231
270
  _fitType;
232
271
  _zoomToFit = false;
233
272
  subs = new Subscription();
273
+ popupSub = new Subscription();
234
274
  emitLoad = true;
235
- constructor(ngZone, renderer, localizationService, cdr, host) {
275
+ pdfViewerWidget;
276
+ constructor(ngZone, renderer, localizationService, cdr, host, popupService) {
236
277
  this.ngZone = ngZone;
237
278
  this.renderer = renderer;
238
279
  this.localizationService = localizationService;
239
280
  this.cdr = cdr;
240
281
  this.host = host;
282
+ this.popupService = popupService;
241
283
  const isValid = validatePackage(packageMetadata);
284
+ this.licenseMessage = getLicenseMessage(packageMetadata);
242
285
  this.showLicenseWatermark = shouldShowValidationUI(isValid);
243
286
  this.direction = localizationService.rtl ? 'rtl' : 'ltr';
244
287
  counter++;
@@ -248,8 +291,11 @@ export class PDFViewerComponent {
248
291
  }
249
292
  ngOnDestroy() {
250
293
  this.subs.unsubscribe();
294
+ this.popupSub?.unsubscribe();
251
295
  this.pdfViewerWidget?.destroy();
252
296
  this.pdfContext = null;
297
+ this.observer?.disconnect();
298
+ this.observer = null;
253
299
  }
254
300
  ngOnChanges(changes) {
255
301
  const newBase64Data = changes['data'] && this.data;
@@ -289,22 +335,40 @@ export class PDFViewerComponent {
289
335
  onPageChange(e) {
290
336
  this.ngZone.runOutsideAngular(() => this.scrollToPage(e.skip + 1));
291
337
  }
338
+ /**
339
+ * @hidden
340
+ */
341
+ onPanningEnabled() {
342
+ this.enabledSelection = false;
343
+ this.showAnnotationsToolbar = false;
344
+ this.ngZone.runOutsideAngular(() => {
345
+ this.pdfViewerWidget?.resetAnnotationEditorMode();
346
+ this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.Pan });
347
+ });
348
+ }
349
+ /**
350
+ * @hidden
351
+ */
352
+ onSelectionEnabled() {
353
+ this.enabledSelection = true;
354
+ this.ngZone.runOutsideAngular(() => {
355
+ this.pdfViewerWidget?.resetAnnotationEditorMode();
356
+ this.pdfViewerWidget?.setInteractionMode({ mode: PdfViewerInteractionMode.TextSelection });
357
+ });
358
+ }
292
359
  /**
293
360
  * @hidden
294
361
  */
295
362
  onDownload() {
296
- this.ngZone.runOutsideAngular(() => this.pdfContext.pdfDoc.getData()
297
- .then((data) => new Blob([data], { type: 'application/pdf' }))
298
- .then((blob) => {
299
- const downloadEvent = new PDFViewerDownloadEvent(blob, this.saveFileName, this.saveOptions, this.pdfContext);
300
- this.zoneAwareEmitter('download', downloadEvent);
301
- if (!downloadEvent.isDefaultPrevented()) {
302
- saveAs(blob, this.saveFileName, this.saveOptions);
303
- }
304
- })
305
- .catch((reason) => {
306
- this.zoneAwareEmitter('error', { error: reason, context: this.pdfContext });
307
- }));
363
+ if (!this.pdfContext?.pdfDoc) {
364
+ this.zoneAwareEmitter('error', { error: 'No document to export.', context: this.pdfContext });
365
+ return;
366
+ }
367
+ const downloadEvent = new PDFViewerDownloadEvent(this.saveFileName, this.saveOptions, this.pdfContext);
368
+ this.zoneAwareEmitter('download', downloadEvent);
369
+ if (!downloadEvent.isDefaultPrevented()) {
370
+ this.ngZone.runOutsideAngular(() => this.pdfViewerWidget?.downloadFile({ fileName: this.saveFileName, saveOptions: this.saveOptions }));
371
+ }
308
372
  }
309
373
  /**
310
374
  * @hidden
@@ -413,7 +477,16 @@ export class PDFViewerComponent {
413
477
  this.pdfViewerWidget?.goToPreviousSearchMatch();
414
478
  this.currentMatch = this.currentMatch - 1 < 1 ? this.currentMatches.length : this.currentMatch - 1;
415
479
  }
416
- pdfViewerWidget;
480
+ /**
481
+ * @hidden
482
+ */
483
+ toggleAnnotationsToolbar() {
484
+ this.showAnnotationsToolbar = !this.showAnnotationsToolbar;
485
+ this.host.nativeElement.querySelector(`#${this.annotationsToolId}`)?.focus();
486
+ if (!this.showAnnotationsToolbar) {
487
+ this.pdfViewerWidget?.resetAnnotationEditorMode();
488
+ }
489
+ }
417
490
  loadPdf(dataType, data) {
418
491
  this.pdfViewerWidget?.destroy();
419
492
  this.loading = true;
@@ -438,7 +511,9 @@ export class PDFViewerComponent {
438
511
  this.loading = false;
439
512
  },
440
513
  scroll: this.scrollHandler,
441
- error: this.errorHandler
514
+ error: this.errorHandler,
515
+ annotationEditorToolBarShow: this.onAnnotationEditorToolBarShowHandler,
516
+ annotationEditorToolBarHide: this.onAnnotationEditorToolBarHideHandler,
442
517
  }
443
518
  });
444
519
  });
@@ -486,6 +561,7 @@ export class PDFViewerComponent {
486
561
  if (!this.pdfContext) {
487
562
  this.pdfViewerWidget.documentScroller.enablePanEventsTracking();
488
563
  }
564
+ this.pdfViewerWidget.setInteractionMode({ mode: PdfViewerInteractionMode.Pan });
489
565
  if (!this._zoomToFit) {
490
566
  this.pdfContext = { ...e, element: this.pagesContainer.nativeElement, zoom: e.sender.state.zoomLevel };
491
567
  if (this.emitLoad) {
@@ -498,6 +574,7 @@ export class PDFViewerComponent {
498
574
  this.pdfContext = { ...e, element: this.pagesContainer.nativeElement };
499
575
  this.onZoomLevelChange(zoomLevelOption, false);
500
576
  }
577
+ this.pdfViewerWidget.activatePageNumber(1);
501
578
  this.cdr.markForCheck();
502
579
  this.assignPageIds();
503
580
  this.ngZone.run(() => this.loading = false);
@@ -515,19 +592,80 @@ export class PDFViewerComponent {
515
592
  this.pdfContext = null;
516
593
  this.zoneAwareEmitter('error', { error: e, context: this.pdfContext });
517
594
  };
595
+ annotationPopup = null;
596
+ observer;
597
+ onAnnotationEditorToolBarShowHandler = (e) => {
598
+ this.cdr.markForCheck();
599
+ this.observer?.disconnect();
600
+ const type = e.annotationEditorMode;
601
+ const anchor = e.anchor;
602
+ const editor = e.source.firstSelectedEditor;
603
+ const popup = this.annotationPopup?.popup;
604
+ // Do not continue if popup is already visible for this annotation.
605
+ if (popup && popup.instance.anchor === anchor && type === "freeText") {
606
+ return;
607
+ }
608
+ if (this.annotationPopup) {
609
+ this.annotationPopup.close();
610
+ this.annotationPopup = null;
611
+ }
612
+ this.annotationPopup = this.popupService.open({
613
+ anchor: anchor,
614
+ appendTo: this.pagesContainerViewContainerRef,
615
+ content: AnnotationPopupToolbarContentComponent,
616
+ popupClass: 'k-pdfviewer-annotation-popup',
617
+ });
618
+ const annotationToolbarInstance = this.annotationPopup.content.instance;
619
+ annotationToolbarInstance.localizationService = this.localizationService;
620
+ annotationToolbarInstance.annotationEditorType = type;
621
+ annotationToolbarInstance.pdfViewerWidget = this.pdfViewerWidget;
622
+ annotationToolbarInstance.anchor = anchor;
623
+ annotationToolbarInstance.popupRef = this.annotationPopup;
624
+ annotationToolbarInstance.initialColor = editor?.color;
625
+ annotationToolbarInstance.initialFontSize = editor.propertiesToUpdate[0][1];
626
+ annotationToolbarInstance.dialogContainer = this.dialogContainerViewContainerRef;
627
+ annotationToolbarInstance.removeAnnotationConfirmation = this.removeAnnotationConfirmation;
628
+ this.popupSub = this.annotationPopup.popup.instance.anchorViewportLeave.subscribe(() => {
629
+ this.ngZone.run(() => this.annotationPopup?.close());
630
+ this.annotationPopup = null;
631
+ this.popupSub?.unsubscribe();
632
+ this.popupSub = null;
633
+ });
634
+ this.ngZone.runOutsideAngular(() => {
635
+ this.observer = this.classMutationObserver(anchor, 'k-selected', () => {
636
+ this.ngZone.run(() => this.annotationPopup?.close());
637
+ });
638
+ });
639
+ };
640
+ onAnnotationEditorToolBarHideHandler = () => {
641
+ this.cdr.markForCheck();
642
+ if (this.annotationPopup?.popup) {
643
+ this.annotationPopup.close();
644
+ this.annotationPopup = null;
645
+ }
646
+ };
518
647
  zoneAwareEmitter = (eventName, eventData) => {
519
648
  if (hasObservers(this[eventName])) {
520
649
  this.ngZone.run(() => this[eventName].emit(eventData));
521
650
  }
522
651
  };
523
- 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 });
524
- 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: [
652
+ classMutationObserver = (element, className, callback) => {
653
+ const observer = new MutationObserver((m) => {
654
+ m.forEach(() => {
655
+ callback();
656
+ });
657
+ });
658
+ observer.observe(element, { attributeFilter: ['class'] });
659
+ return observer;
660
+ };
661
+ 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 }, { token: i2.PopupService }], target: i0.ɵɵFactoryTarget.Component });
662
+ 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", 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: [
525
663
  LocalizationService,
526
664
  {
527
665
  provide: L10N_PREFIX,
528
666
  useValue: 'kendo.pdfviewer'
529
667
  }
530
- ], viewQueries: [{ propertyName: "pagesContainer", first: true, predicate: ["pagesContainer"], descendants: true }], exportAs: ["kendo-pdfviewer"], usesOnChanges: true, ngImport: i0, template: `
668
+ ], 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: `
531
669
  <ng-container kendoPDFViewerLocalizedMessages
532
670
  i18n-pagerFirstPage="kendo.pdfviewer.pagerFirstPage|The label for the first page button in the Pager"
533
671
  pagerFirstPage="Go to the first page"
@@ -552,59 +690,95 @@ export class PDFViewerComponent {
552
690
 
553
691
  i18n-pagerInputLabel="kendo.pdfviewer.pagerInputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
554
692
  pagerInputLabel="Type a page number"
555
-
693
+
556
694
  i18n-zoomInTitle="kendo.pdfviewer.zoomInTitle|The ZoomIn tool title and label."
557
695
  zoomInTitle="Zoom in"
558
-
696
+
559
697
  i18n-zoomOutTitle="kendo.pdfviewer.zoomOutTitle|The ZoomOut tool title and label."
560
698
  zoomOutTitle="Zoom out"
561
-
699
+
562
700
  i18n-selectionTitle="kendo.pdfviewer.selectionTitle|The Selection tool title and label."
563
701
  selectionTitle="Enable selection"
564
-
702
+
565
703
  i18n-panningTitle="kendo.pdfviewer.panningTitle|The Panning tool title and label."
566
704
  panningTitle="Enable panning"
567
-
705
+
568
706
  i18n-searchTitle="kendo.pdfviewer.searchTitle|The Search tool title and label."
569
707
  searchTitle="Search"
570
-
708
+
571
709
  i18n-openTitle="kendo.pdfviewer.openTitle|The Open tool title and label."
572
710
  openTitle="Open"
573
-
711
+
574
712
  i18n-downloadTitle="kendo.pdfviewer.downloadTitle|The Download tool title and label."
575
713
  downloadTitle="Download"
576
-
714
+
577
715
  i18n-printTitle="kendo.pdfviewer.printTitle|The Print tool title and label."
578
716
  printTitle="Print"
579
-
717
+
580
718
  i18n-fitToPage="kendo.pdfviewer.fitToPage|The text for the zoom level chooser Fit to page option."
581
719
  fitToPage="Fit to page"
582
-
720
+
583
721
  i18n-fitToWidth="kendo.pdfviewer.fitToWidth|The text for the zoom level chooser Fit to width option."
584
722
  fitToWidth="Fit to width"
585
-
723
+
586
724
  i18n-searchInputPlaceholder="kendo.pdfviewer.searchInputPlaceholder|The text for the search input placeholder."
587
725
  searchInputPlaceholder="Search"
588
-
726
+
589
727
  i18n-searchMatchesOf="kendo.pdfviewer.searchMatchesOf|The text before the total number of matches in the Search tool."
590
728
  searchMatchesOf="of"
591
-
729
+
592
730
  i18n-searchPreviousMatchTitle="kendo.pdfviewer.searchPreviousMatchTitle|The title of the Search tool previous match button."
593
731
  searchPreviousMatchTitle="Previous match"
594
-
732
+
595
733
  i18n-searchNextMatchTitle="kendo.pdfviewer.searchNextMatchTitle|The title of the Search tool next match button."
596
734
  searchNextMatchTitle="Next match"
597
-
735
+
598
736
  i18n-searchCloseTitle="kendo.pdfviewer.searchCloseTitle|The title of the Search tool close button."
599
737
  searchCloseTitle="Close"
600
-
738
+
601
739
  i18n-searchMatchCaseTitle="kendo.pdfviewer.searchMatchCaseTitle|The title of the Search tool match case button."
602
740
  searchMatchCaseTitle="Match case"
603
-
741
+
604
742
  i18n-zoomInputPlaceholder="kendo.pdfviewer.zoomInputPlaceholder|The text for the zoom tool input placeholder."
605
- zoomInputPlaceholder="Choose zoom level">
743
+ zoomInputPlaceholder="Choose zoom level"
744
+
745
+ i18n-annotationsTitle="kendo.pdfviewer.annotationsTitle|The Annotations tool title and label."
746
+ annotationsTitle="Annotations"
747
+
748
+ i18n-annotationEditorTitle="kendo.pdfviewer.annotationEditorTitle|The annotation editor tool title and label."
749
+ annotationEditorTitle="Annotation editor"
750
+
751
+ i18n-deleteAnnotationTitle="kendo.pdfviewer.deleteAnnotationTitle|The delete annotation tool title and label."
752
+ deleteAnnotationTitle="Delete annotation"
753
+
754
+ i18n-highlightAnnotationTitle="kendo.pdfviewer.highlightAnnotationTitle|The highlight annotation tool title and label."
755
+ highlightAnnotationTitle="Highlight"
756
+
757
+ i18n-freeTextAnnotationTitle="kendo.pdfviewer.freeTextAnnotationTitle|The free text annotation tool title and label."
758
+ freeTextAnnotationTitle="Free text"
759
+
760
+ i18n-closeAnnotationsToolbarTitle="kendo.pdfviewer.closeAnnotationsToolbarTitle|The close annotations toolbar tool title and label."
761
+ closeAnnotationsToolbarTitle="Close"
762
+
763
+ i18n-deleteAnnotationConfirmationDialogTitle="kendo.pdfviewer.deleteAnnotationConfirmationDialogTitle|The delete annotation confirmation dialog title."
764
+ deleteAnnotationConfirmationDialogTitle="Delete annotation"
765
+
766
+ i18n-deleteAnnotationConfirmationDialogContent="kendo.pdfviewer.deleteAnnotationConfirmationDialogContent|The delete annotation confirmation dialog content."
767
+ deleteAnnotationConfirmationDialogContent="Are you sure you want to delete this annotation?"
768
+
769
+ i18n-deleteAnnotationConfirmationDialogConfirmText="kendo.pdfviewer.deleteAnnotationConfirmationDialogConfirmText|The delete annotation confirmation dialog confirm button text."
770
+ deleteAnnotationConfirmationDialogConfirmText="Delete"
771
+
772
+ i18n-deleteAnnotationConfirmationDialogRejectText="kendo.pdfviewer.deleteAnnotationConfirmationDialogRejectText|The delete annotation confirmation dialog reject button text."
773
+ deleteAnnotationConfirmationDialogRejectText="Cancel"
774
+
775
+ i18n-annotationEditorFontSizeTitle="kendo.pdfviewer.annotationEditorFontSizeTitle|The annotation editor font size section title."
776
+ annotationEditorFontSizeTitle="Font size"
777
+
778
+ i18n-annotationEditorColorTitle="kendo.pdfviewer.annotationEditorColorTitle|The annotation editor color section title."
779
+ annotationEditorColorTitle="Color">
606
780
  </ng-container>
607
- <div kendoPDFViewerLoader
781
+ <div kendoPDFViewerLoader
608
782
  *ngIf="loading"
609
783
  [settings]="loaderSettings"></div>
610
784
  <div kendoPDFViewerToolbar
@@ -620,18 +794,32 @@ export class PDFViewerComponent {
620
794
  [zoomOptionsData]="zoomOptionsData"
621
795
  [zoomLevelChooserValue]="zoomLevel"
622
796
  [disabledTools]="!pdfContext?.pdfDoc"
797
+ [isAnnotationsToolbarVisible]="showAnnotationsToolbar"
798
+ [wrapperId]="showAnnotationsToolbar ? annotationsToolbarId : undefined"
799
+ [annotationsToolId]="annotationsToolId"
623
800
  (pageChange)="onPageChange($event)"
624
801
  (fileSelect)="onFileSelect($event)"
625
802
  (fileSelectStart)="loading = true;"
626
803
  (fileSelectError)="onFileSelectError($event)"
627
804
  (download)="onDownload()"
628
- (panningEnabled)="enabledSelection = false;"
629
- (selectionEnabled)="enabledSelection = true;"
805
+ (panningEnabled)="onPanningEnabled();"
806
+ (selectionEnabled)="onSelectionEnabled();"
630
807
  (zoomIn)="onZoomIn()"
631
808
  (zoomOut)="onZoomOut()"
632
809
  (zoomLevelChange)="onZoomLevelChange($event)"
633
810
  (print)="onPrint()"
634
- (search)="onSearch()"></div>
811
+ (search)="onSearch()"
812
+ (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
813
+ <div *ngIf="showAnnotationsToolbar"
814
+ [attr.id]="annotationsToolbarId"
815
+ kendoPDFViewerToolbar
816
+ #toolbar
817
+ role="toolbar"
818
+ type="annotations"
819
+ (setAnnotationMode)="onSetAnnotationMode($event)"
820
+ [attr.aria-controls]="pagesContainerId"
821
+ [disabledTools]="!pdfContext?.pdfDoc"
822
+ (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
635
823
  <div
636
824
  class="k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto"
637
825
  [class.k-enable-text-select]="enabledSelection"
@@ -648,7 +836,7 @@ export class PDFViewerComponent {
648
836
  (prevMatch)="onPreviousMatch()"
649
837
  (nextMatch)="onNextMatch()"
650
838
  (close)="closeSearch(toolbar)"></div>
651
- <div
839
+ <div
652
840
  #pagesContainer
653
841
  [kendoEventsOutsideAngular]="{
654
842
  wheel: stopPropagation
@@ -657,8 +845,9 @@ export class PDFViewerComponent {
657
845
  [attr.id]="pagesContainerId"></div>
658
846
  </div>
659
847
 
660
- <div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
661
- `, 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]" }] });
848
+ <div #dialogContainer></div>
849
+ <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
850
+ `, 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", "type", "wrapperId", "isAnnotationsToolbarVisible", "annotationsToolId"], 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"] }] });
662
851
  }
663
852
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFViewerComponent, decorators: [{
664
853
  type: Component,
@@ -697,59 +886,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
697
886
 
698
887
  i18n-pagerInputLabel="kendo.pdfviewer.pagerInputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
699
888
  pagerInputLabel="Type a page number"
700
-
889
+
701
890
  i18n-zoomInTitle="kendo.pdfviewer.zoomInTitle|The ZoomIn tool title and label."
702
891
  zoomInTitle="Zoom in"
703
-
892
+
704
893
  i18n-zoomOutTitle="kendo.pdfviewer.zoomOutTitle|The ZoomOut tool title and label."
705
894
  zoomOutTitle="Zoom out"
706
-
895
+
707
896
  i18n-selectionTitle="kendo.pdfviewer.selectionTitle|The Selection tool title and label."
708
897
  selectionTitle="Enable selection"
709
-
898
+
710
899
  i18n-panningTitle="kendo.pdfviewer.panningTitle|The Panning tool title and label."
711
900
  panningTitle="Enable panning"
712
-
901
+
713
902
  i18n-searchTitle="kendo.pdfviewer.searchTitle|The Search tool title and label."
714
903
  searchTitle="Search"
715
-
904
+
716
905
  i18n-openTitle="kendo.pdfviewer.openTitle|The Open tool title and label."
717
906
  openTitle="Open"
718
-
907
+
719
908
  i18n-downloadTitle="kendo.pdfviewer.downloadTitle|The Download tool title and label."
720
909
  downloadTitle="Download"
721
-
910
+
722
911
  i18n-printTitle="kendo.pdfviewer.printTitle|The Print tool title and label."
723
912
  printTitle="Print"
724
-
913
+
725
914
  i18n-fitToPage="kendo.pdfviewer.fitToPage|The text for the zoom level chooser Fit to page option."
726
915
  fitToPage="Fit to page"
727
-
916
+
728
917
  i18n-fitToWidth="kendo.pdfviewer.fitToWidth|The text for the zoom level chooser Fit to width option."
729
918
  fitToWidth="Fit to width"
730
-
919
+
731
920
  i18n-searchInputPlaceholder="kendo.pdfviewer.searchInputPlaceholder|The text for the search input placeholder."
732
921
  searchInputPlaceholder="Search"
733
-
922
+
734
923
  i18n-searchMatchesOf="kendo.pdfviewer.searchMatchesOf|The text before the total number of matches in the Search tool."
735
924
  searchMatchesOf="of"
736
-
925
+
737
926
  i18n-searchPreviousMatchTitle="kendo.pdfviewer.searchPreviousMatchTitle|The title of the Search tool previous match button."
738
927
  searchPreviousMatchTitle="Previous match"
739
-
928
+
740
929
  i18n-searchNextMatchTitle="kendo.pdfviewer.searchNextMatchTitle|The title of the Search tool next match button."
741
930
  searchNextMatchTitle="Next match"
742
-
931
+
743
932
  i18n-searchCloseTitle="kendo.pdfviewer.searchCloseTitle|The title of the Search tool close button."
744
933
  searchCloseTitle="Close"
745
-
934
+
746
935
  i18n-searchMatchCaseTitle="kendo.pdfviewer.searchMatchCaseTitle|The title of the Search tool match case button."
747
936
  searchMatchCaseTitle="Match case"
748
-
937
+
749
938
  i18n-zoomInputPlaceholder="kendo.pdfviewer.zoomInputPlaceholder|The text for the zoom tool input placeholder."
750
- zoomInputPlaceholder="Choose zoom level">
939
+ zoomInputPlaceholder="Choose zoom level"
940
+
941
+ i18n-annotationsTitle="kendo.pdfviewer.annotationsTitle|The Annotations tool title and label."
942
+ annotationsTitle="Annotations"
943
+
944
+ i18n-annotationEditorTitle="kendo.pdfviewer.annotationEditorTitle|The annotation editor tool title and label."
945
+ annotationEditorTitle="Annotation editor"
946
+
947
+ i18n-deleteAnnotationTitle="kendo.pdfviewer.deleteAnnotationTitle|The delete annotation tool title and label."
948
+ deleteAnnotationTitle="Delete annotation"
949
+
950
+ i18n-highlightAnnotationTitle="kendo.pdfviewer.highlightAnnotationTitle|The highlight annotation tool title and label."
951
+ highlightAnnotationTitle="Highlight"
952
+
953
+ i18n-freeTextAnnotationTitle="kendo.pdfviewer.freeTextAnnotationTitle|The free text annotation tool title and label."
954
+ freeTextAnnotationTitle="Free text"
955
+
956
+ i18n-closeAnnotationsToolbarTitle="kendo.pdfviewer.closeAnnotationsToolbarTitle|The close annotations toolbar tool title and label."
957
+ closeAnnotationsToolbarTitle="Close"
958
+
959
+ i18n-deleteAnnotationConfirmationDialogTitle="kendo.pdfviewer.deleteAnnotationConfirmationDialogTitle|The delete annotation confirmation dialog title."
960
+ deleteAnnotationConfirmationDialogTitle="Delete annotation"
961
+
962
+ i18n-deleteAnnotationConfirmationDialogContent="kendo.pdfviewer.deleteAnnotationConfirmationDialogContent|The delete annotation confirmation dialog content."
963
+ deleteAnnotationConfirmationDialogContent="Are you sure you want to delete this annotation?"
964
+
965
+ i18n-deleteAnnotationConfirmationDialogConfirmText="kendo.pdfviewer.deleteAnnotationConfirmationDialogConfirmText|The delete annotation confirmation dialog confirm button text."
966
+ deleteAnnotationConfirmationDialogConfirmText="Delete"
967
+
968
+ i18n-deleteAnnotationConfirmationDialogRejectText="kendo.pdfviewer.deleteAnnotationConfirmationDialogRejectText|The delete annotation confirmation dialog reject button text."
969
+ deleteAnnotationConfirmationDialogRejectText="Cancel"
970
+
971
+ i18n-annotationEditorFontSizeTitle="kendo.pdfviewer.annotationEditorFontSizeTitle|The annotation editor font size section title."
972
+ annotationEditorFontSizeTitle="Font size"
973
+
974
+ i18n-annotationEditorColorTitle="kendo.pdfviewer.annotationEditorColorTitle|The annotation editor color section title."
975
+ annotationEditorColorTitle="Color">
751
976
  </ng-container>
752
- <div kendoPDFViewerLoader
977
+ <div kendoPDFViewerLoader
753
978
  *ngIf="loading"
754
979
  [settings]="loaderSettings"></div>
755
980
  <div kendoPDFViewerToolbar
@@ -765,18 +990,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
765
990
  [zoomOptionsData]="zoomOptionsData"
766
991
  [zoomLevelChooserValue]="zoomLevel"
767
992
  [disabledTools]="!pdfContext?.pdfDoc"
993
+ [isAnnotationsToolbarVisible]="showAnnotationsToolbar"
994
+ [wrapperId]="showAnnotationsToolbar ? annotationsToolbarId : undefined"
995
+ [annotationsToolId]="annotationsToolId"
768
996
  (pageChange)="onPageChange($event)"
769
997
  (fileSelect)="onFileSelect($event)"
770
998
  (fileSelectStart)="loading = true;"
771
999
  (fileSelectError)="onFileSelectError($event)"
772
1000
  (download)="onDownload()"
773
- (panningEnabled)="enabledSelection = false;"
774
- (selectionEnabled)="enabledSelection = true;"
1001
+ (panningEnabled)="onPanningEnabled();"
1002
+ (selectionEnabled)="onSelectionEnabled();"
775
1003
  (zoomIn)="onZoomIn()"
776
1004
  (zoomOut)="onZoomOut()"
777
1005
  (zoomLevelChange)="onZoomLevelChange($event)"
778
1006
  (print)="onPrint()"
779
- (search)="onSearch()"></div>
1007
+ (search)="onSearch()"
1008
+ (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
1009
+ <div *ngIf="showAnnotationsToolbar"
1010
+ [attr.id]="annotationsToolbarId"
1011
+ kendoPDFViewerToolbar
1012
+ #toolbar
1013
+ role="toolbar"
1014
+ type="annotations"
1015
+ (setAnnotationMode)="onSetAnnotationMode($event)"
1016
+ [attr.aria-controls]="pagesContainerId"
1017
+ [disabledTools]="!pdfContext?.pdfDoc"
1018
+ (toggleAnnotationsToolbar)="toggleAnnotationsToolbar()"></div>
780
1019
  <div
781
1020
  class="k-canvas k-pdf-viewer-canvas k-pos-relative k-overflow-auto"
782
1021
  [class.k-enable-text-select]="enabledSelection"
@@ -793,7 +1032,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
793
1032
  (prevMatch)="onPreviousMatch()"
794
1033
  (nextMatch)="onNextMatch()"
795
1034
  (close)="closeSearch(toolbar)"></div>
796
- <div
1035
+ <div
797
1036
  #pagesContainer
798
1037
  [kendoEventsOutsideAngular]="{
799
1038
  wheel: stopPropagation
@@ -802,17 +1041,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
802
1041
  [attr.id]="pagesContainerId"></div>
803
1042
  </div>
804
1043
 
805
- <div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
1044
+ <div #dialogContainer></div>
1045
+ <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
806
1046
  `,
807
1047
  standalone: true,
808
1048
  imports: [LocalizedPDFViewerMessagesDirective, NgIf, EventsOutsideAngularDirective, LoaderComponent, ToolbarComponent, PDFViewerSearchComponent, WatermarkOverlayComponent]
809
1049
  }]
810
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { hostClass: [{
1050
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i2.PopupService }]; }, propDecorators: { hostClass: [{
811
1051
  type: HostBinding,
812
1052
  args: ['class.k-pdf-viewer']
813
1053
  }], direction: [{
814
1054
  type: HostBinding,
815
1055
  args: ['attr.dir']
1056
+ }], display: [{
1057
+ type: HostBinding,
1058
+ args: ['attr.display']
816
1059
  }], tools: [{
817
1060
  type: Input
818
1061
  }], loaderSettings: [{
@@ -841,6 +1084,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
841
1084
  type: Input
842
1085
  }], loadOnDemandPageSize: [{
843
1086
  type: Input
1087
+ }], removeAnnotationConfirmation: [{
1088
+ type: Input
844
1089
  }], load: [{
845
1090
  type: Output
846
1091
  }], error: [{
@@ -854,4 +1099,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
854
1099
  }], pagesContainer: [{
855
1100
  type: ViewChild,
856
1101
  args: ['pagesContainer']
1102
+ }], pagesContainerViewContainerRef: [{
1103
+ type: ViewChild,
1104
+ args: ['pagesContainer', { read: ViewContainerRef }]
1105
+ }], dialogContainerViewContainerRef: [{
1106
+ type: ViewChild,
1107
+ args: ['dialogContainer', { read: ViewContainerRef }]
857
1108
  }] } });