@progress/kendo-angular-pdfviewer 19.3.0-develop.3 → 19.3.0-develop.31

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