nuxeo-development-framework 4.5.4 → 4.5.5

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.
@@ -29769,6 +29769,104 @@
29769
29769
  }]
29770
29770
  }], ctorParameters: function () { return []; } });
29771
29771
 
29772
+ var _SilentPdfTronService_instances, _SilentPdfTronService_webViewerInstance, _SilentPdfTronService_webViewerElement, _SilentPdfTronService_isInitialized, _SilentPdfTronService_initializationPromise, _SilentPdfTronService_isArabic, _SilentPdfTronService_isEnabled, _SilentPdfTronService_initializeWebViewer;
29773
+ var SilentPdfTronService = /** @class */ (function () {
29774
+ function SilentPdfTronService(baseHref, translationService, environment, nuxeo) {
29775
+ this.baseHref = baseHref;
29776
+ this.translationService = translationService;
29777
+ this.environment = environment;
29778
+ this.nuxeo = nuxeo;
29779
+ _SilentPdfTronService_instances.add(this);
29780
+ _SilentPdfTronService_webViewerInstance.set(this, void 0);
29781
+ _SilentPdfTronService_webViewerElement.set(this, null);
29782
+ _SilentPdfTronService_isInitialized.set(this, false);
29783
+ _SilentPdfTronService_initializationPromise.set(this, null);
29784
+ _SilentPdfTronService_isArabic.set(this, void 0);
29785
+ _SilentPdfTronService_isEnabled.set(this, void 0);
29786
+ }
29787
+ Object.defineProperty(SilentPdfTronService.prototype, "isEnabled", {
29788
+ get: function () {
29789
+ return __classPrivateFieldGet(this, _SilentPdfTronService_isEnabled, "f");
29790
+ },
29791
+ enumerable: false,
29792
+ configurable: true
29793
+ });
29794
+ SilentPdfTronService.prototype.start = function () {
29795
+ var _this = this;
29796
+ __classPrivateFieldSet(this, _SilentPdfTronService_isEnabled, true, "f");
29797
+ this.translationService.isArabic.subscribe(function (res) {
29798
+ __classPrivateFieldSet(_this, _SilentPdfTronService_isArabic, res, "f");
29799
+ if (!__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f")) {
29800
+ __classPrivateFieldSet(_this, _SilentPdfTronService_webViewerElement, document.createElement('div'), "f");
29801
+ __classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f").id = 'silent-viewer';
29802
+ Object.assign(__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f").style, {
29803
+ display: 'none',
29804
+ width: '100%',
29805
+ height: '100%'
29806
+ });
29807
+ document.body.appendChild(__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f"));
29808
+ }
29809
+ __classPrivateFieldGet(_this, _SilentPdfTronService_instances, "m", _SilentPdfTronService_initializeWebViewer).call(_this);
29810
+ });
29811
+ };
29812
+ SilentPdfTronService.prototype.getWebViewer = function () {
29813
+ var _this = this;
29814
+ if (__classPrivateFieldGet(this, _SilentPdfTronService_isInitialized, "f") && __classPrivateFieldGet(this, _SilentPdfTronService_webViewerElement, "f") && __classPrivateFieldGet(this, _SilentPdfTronService_webViewerInstance, "f")) {
29815
+ return Promise.resolve([__classPrivateFieldGet(this, _SilentPdfTronService_webViewerElement, "f"), __classPrivateFieldGet(this, _SilentPdfTronService_webViewerInstance, "f")]);
29816
+ }
29817
+ return __classPrivateFieldGet(this, _SilentPdfTronService_instances, "m", _SilentPdfTronService_initializeWebViewer).call(this).then(function () {
29818
+ if (!__classPrivateFieldGet(_this, _SilentPdfTronService_isInitialized, "f") || !__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f") || !__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerInstance, "f")) {
29819
+ return Promise.reject(new Error('WebViewer initialization failed.'));
29820
+ }
29821
+ return [__classPrivateFieldGet(_this, _SilentPdfTronService_webViewerElement, "f"), __classPrivateFieldGet(_this, _SilentPdfTronService_webViewerInstance, "f")];
29822
+ });
29823
+ };
29824
+ return SilentPdfTronService;
29825
+ }());
29826
+ _SilentPdfTronService_webViewerInstance = new WeakMap(), _SilentPdfTronService_webViewerElement = new WeakMap(), _SilentPdfTronService_isInitialized = new WeakMap(), _SilentPdfTronService_initializationPromise = new WeakMap(), _SilentPdfTronService_isArabic = new WeakMap(), _SilentPdfTronService_isEnabled = new WeakMap(), _SilentPdfTronService_instances = new WeakSet(), _SilentPdfTronService_initializeWebViewer = function _SilentPdfTronService_initializeWebViewer() {
29827
+ var _this = this;
29828
+ if (__classPrivateFieldGet(this, _SilentPdfTronService_isInitialized, "f"))
29829
+ return Promise.resolve();
29830
+ if (__classPrivateFieldGet(this, _SilentPdfTronService_initializationPromise, "f"))
29831
+ return __classPrivateFieldGet(this, _SilentPdfTronService_initializationPromise, "f");
29832
+ __classPrivateFieldSet(this, _SilentPdfTronService_initializationPromise, WebViewer__default["default"]({
29833
+ path: this.baseHref + "/assets/pdftrons",
29834
+ forceClientSideInit: true,
29835
+ streaming: true,
29836
+ licenseKey: this.environment.pdftronLicenceKey,
29837
+ css: this.baseHref + "/assets/styles/" + (__classPrivateFieldGet(this, _SilentPdfTronService_isArabic, "f") ? 'ar' : 'en') + "-mypdftron.css",
29838
+ annotationUser: this.nuxeo.nuxeoClient.user.properties.firstName + " " + this.nuxeo.nuxeoClient.user.properties.lastName,
29839
+ disabledElements: ['downloadButton', 'printButton']
29840
+ }, __classPrivateFieldGet(this, _SilentPdfTronService_webViewerElement, "f"))
29841
+ .then(function (instance) {
29842
+ __classPrivateFieldSet(_this, _SilentPdfTronService_webViewerInstance, instance, "f");
29843
+ __classPrivateFieldSet(_this, _SilentPdfTronService_isInitialized, true, "f");
29844
+ })
29845
+ .catch(function (error) {
29846
+ console.error('Failed to initialize WebViewer:', error);
29847
+ __classPrivateFieldSet(_this, _SilentPdfTronService_initializationPromise, null, "f");
29848
+ return Promise.reject(error);
29849
+ }), "f");
29850
+ return __classPrivateFieldGet(this, _SilentPdfTronService_initializationPromise, "f");
29851
+ };
29852
+ SilentPdfTronService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SilentPdfTronService, deps: [{ token: i4.APP_BASE_HREF }, { token: TranslationService }, { token: 'environment' }, { token: NuxeoService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
29853
+ SilentPdfTronService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SilentPdfTronService, providedIn: 'root' });
29854
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SilentPdfTronService, decorators: [{
29855
+ type: i0.Injectable,
29856
+ args: [{
29857
+ providedIn: 'root'
29858
+ }]
29859
+ }], ctorParameters: function () {
29860
+ return [{ type: undefined, decorators: [{
29861
+ type: i0.Inject,
29862
+ args: [i4.APP_BASE_HREF]
29863
+ }] }, { type: TranslationService }, { type: undefined, decorators: [{
29864
+ type: i0.Inject,
29865
+ args: ['environment']
29866
+ }] }, { type: NuxeoService }];
29867
+ } });
29868
+
29869
+ var _PdftronComponent_instances, _PdftronComponent_updateSilentPdfTron, _PdftronComponent_afterLoadWebViewer, _PdftronComponent_docLoaded, _PdftronComponent_reset;
29772
29870
  /**
29773
29871
  * A reusable file viewer based on PDFTron Library
29774
29872
  * @title
@@ -29783,16 +29881,16 @@
29783
29881
  * </app-pdftron>
29784
29882
  */
29785
29883
  var PdftronComponent = /** @class */ (function () {
29786
- function PdftronComponent(cdr, pdftronService, nuxeo, baseHref, securePipe, translationService, toaster, environment) {
29884
+ function PdftronComponent(cdr, pdftronService, nuxeo, baseHref, translationService, silentPdfTronService, environment) {
29787
29885
  var _this = this;
29788
29886
  this.cdr = cdr;
29789
29887
  this.pdftronService = pdftronService;
29790
29888
  this.nuxeo = nuxeo;
29791
29889
  this.baseHref = baseHref;
29792
- this.securePipe = securePipe;
29793
29890
  this.translationService = translationService;
29794
- this.toaster = toaster;
29891
+ this.silentPdfTronService = silentPdfTronService;
29795
29892
  this.environment = environment;
29893
+ _PdftronComponent_instances.add(this);
29796
29894
  this.actionClicked = false; // used to know if there is action clicked outside to start edit mode or not
29797
29895
  this.DOCUMENT_TYPE = 'application/pdf';
29798
29896
  this.fitMode = 'FitWidth';
@@ -29807,8 +29905,18 @@
29807
29905
  this.events = new i0.EventEmitter();
29808
29906
  this.SignatureEvent = new i0.EventEmitter(); // used to export signature to outside
29809
29907
  this.firstTimeLoad = true; //flage to control importing signatures in the first time load only
29810
- this.firstSignatureLoad = true; // flage to pass first load of imported signatures without emitting the event
29908
+ this.firstSignatureLoad = true; // flage to pass first load of imported signatures without emitting the event
29811
29909
  this.newSignCreation = false; // flage to indicate signature creation is created or choosed from stored ones
29910
+ _PdftronComponent_docLoaded.set(this, function () {
29911
+ var fitMode = _this.webViewerInstance.FitMode.FitWidth;
29912
+ if (_this.fitMode === 'FitPage') {
29913
+ fitMode = _this.webViewerInstance.FitMode.FitPage;
29914
+ }
29915
+ else if (_this.fitMode === 'Zoom') {
29916
+ fitMode = _this.webViewerInstance.FitMode.Zoom;
29917
+ }
29918
+ _this.webViewerInstance.setFitMode(fitMode);
29919
+ });
29812
29920
  this.savedAnotations = [];
29813
29921
  this.fileWithOcr = false;
29814
29922
  this.newAnnotations = [];
@@ -29834,13 +29942,13 @@
29834
29942
  _this.pages.pages.forEach(function (page, index) {
29835
29943
  _this.pageHeight = page.page_height;
29836
29944
  _this.pageWidth = page.page_width;
29837
- _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight((index + 1));
29838
- _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth((index + 1));
29945
+ _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight(index + 1);
29946
+ _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth(index + 1);
29839
29947
  page.zones.forEach(function (zone) {
29840
29948
  zone.paragraphs.forEach(function (paragraph) {
29841
29949
  paragraph.lines.forEach(function (line) {
29842
29950
  if (line.text.includes(searchValue)) {
29843
- _this.SearchForWordInLine(mySearch_1, line, (index + 1), page);
29951
+ _this.SearchForWordInLine(mySearch_1, line, index + 1, page);
29844
29952
  }
29845
29953
  });
29846
29954
  });
@@ -29848,7 +29956,7 @@
29848
29956
  });
29849
29957
  }
29850
29958
  else {
29851
- // then i am searching with only one word
29959
+ // then i am searching with only one word
29852
29960
  _this.searchForWordInAllPages(searchValue);
29853
29961
  }
29854
29962
  _this.webViewerInstance.docViewer.clearSearchResults();
@@ -29862,81 +29970,58 @@
29862
29970
  }
29863
29971
  PdftronComponent.prototype.ngOnInit = function () {
29864
29972
  return __awaiter(this, void 0, void 0, function () {
29973
+ var _b;
29865
29974
  var _this = this;
29866
- return __generator(this, function (_a) {
29867
- this.transelationSubscrition = this.translationService.isArabic.subscribe(function (res) {
29868
- _this.isArabic = res;
29869
- });
29870
- return [2 /*return*/];
29871
- });
29872
- });
29873
- };
29874
- PdftronComponent.prototype.ngAfterViewInit = function () {
29875
- return __awaiter(this, void 0, void 0, function () {
29876
- var _this = this;
29877
- return __generator(this, function (_a) {
29878
- this.recivedSearchStringsArray = this.searchString.trim() ? this.searchString.split(',') : [];
29879
- if (this.fileTitle) {
29880
- if (this.fileTitle.endsWith('.ppt')) {
29881
- this.DOCUMENT_TYPE = 'application/vnd.ms-powerpoint';
29882
- }
29883
- else if (this.fileTitle.endsWith('.pptx')) {
29884
- this.DOCUMENT_TYPE =
29885
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
29886
- }
29887
- else if (this.fileTitle.endsWith('.doc')) {
29888
- this.DOCUMENT_TYPE = 'application/msword';
29889
- }
29890
- else if (this.fileTitle.endsWith('.docx')) {
29891
- this.DOCUMENT_TYPE =
29892
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
29893
- }
29894
- }
29895
- WebViewer__default["default"]({
29896
- path: this.baseHref + '/assets/pdftrons',
29897
- forceClientSideInit: true,
29898
- streaming: true,
29899
- licenseKey: this.environment.pdftronLicenceKey,
29900
- css: this.isArabic ? (this.baseHref + '/assets/styles/ar-mypdftron.css') : (this.baseHref + '/assets/styles/en-mypdftron.css'),
29901
- annotationUser: this.nuxeo.nuxeoClient.user.properties.firstName + ' ' + this.nuxeo.nuxeoClient.user.properties.lastName,
29902
- disabledElements: ['downloadButton', 'printButton'],
29903
- }, this.viewerRef.nativeElement).then(function (instance) { return __awaiter(_this, void 0, void 0, function () {
29904
- return __generator(this, function (_a) {
29905
- this.isArabic ? instance.setLanguage('ar') : instance.setLanguage('en');
29906
- this.pdftronService.instance = this.webViewerInstance = instance;
29907
- if (this.correspondance.facets.indexOf('ctocr') > -1) {
29908
- this.fileWithOcr = true;
29909
- this.pages = JSON.parse(this.correspondance.properties['ctocr:recognizedJson']);
29910
- // override search funtion to use our search in ocr not defult search
29911
- instance.overrideSearchExecution(this.searchFn);
29912
- }
29913
- else {
29914
- // if no ocr then add search lisner to lisne to internal search and catch results
29915
- this.addSearchListner();
29916
- }
29917
- this.addPrintButton();
29918
- this.addDownloadButton();
29919
- this.importSignature();
29920
- this.exportingSignature();
29921
- this.deleteAnnotation();
29922
- this.exportingSavedSignature();
29923
- if (this.useOutsideAnotations) {
29924
- this.importAnotationsFromOutside();
29925
- this.exportAnotationsToOutside();
29926
- }
29927
- this.webViewerInstance.docViewer.setSearchHighlightColors({
29928
- // setSearchHighlightColors accepts both Annotations.Color objects or 'rgba' strings
29929
- searchResult: new this.webViewerInstance.Annotations.Color(250, 206, 0, 0.50196),
29930
- activeSearchResult: new this.webViewerInstance.Annotations.Color(250, 206, 0, 0.50196),
29975
+ return __generator(this, function (_c) {
29976
+ switch (_c.label) {
29977
+ case 0:
29978
+ this.transelationSubscrition = this.translationService.isArabic.subscribe(function (res) {
29979
+ _this.isArabic = res;
29931
29980
  });
29932
- if (this.recivedSearchStringsArray.length !== 0) {
29933
- this.automaticSearch(this.recivedSearchStringsArray);
29981
+ this.recivedSearchStringsArray = this.searchString.trim() ? this.searchString.split(',') : [];
29982
+ if (this.fileTitle) {
29983
+ if (this.fileTitle.endsWith('.ppt')) {
29984
+ this.DOCUMENT_TYPE = 'application/vnd.ms-powerpoint';
29985
+ }
29986
+ else if (this.fileTitle.endsWith('.pptx')) {
29987
+ this.DOCUMENT_TYPE = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
29988
+ }
29989
+ else if (this.fileTitle.endsWith('.doc')) {
29990
+ this.DOCUMENT_TYPE = 'application/msword';
29991
+ }
29992
+ else if (this.fileTitle.endsWith('.docx')) {
29993
+ this.DOCUMENT_TYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
29994
+ }
29934
29995
  }
29935
- this.loadDocument();
29936
- return [2 /*return*/];
29937
- });
29938
- }); });
29939
- return [2 /*return*/];
29996
+ if (!this.silentPdfTronService.isEnabled) return [3 /*break*/, 2];
29997
+ return [4 /*yield*/, this.silentPdfTronService.getWebViewer()];
29998
+ case 1:
29999
+ _b = __read.apply(void 0, [_c.sent(), 2]), this.silentPdfTron = _b[0], this.webViewerInstance = _b[1];
30000
+ __classPrivateFieldGet(this, _PdftronComponent_instances, "m", _PdftronComponent_afterLoadWebViewer).call(this, this.webViewerInstance);
30001
+ this.resizeObserver = new ResizeObserver(function () { return __classPrivateFieldGet(_this, _PdftronComponent_instances, "m", _PdftronComponent_updateSilentPdfTron).call(_this); });
30002
+ this.resizeObserver.observe(this.viewerRef.nativeElement);
30003
+ __classPrivateFieldGet(this, _PdftronComponent_instances, "m", _PdftronComponent_updateSilentPdfTron).call(this);
30004
+ return [3 /*break*/, 3];
30005
+ case 2:
30006
+ WebViewer__default["default"]({
30007
+ path: this.baseHref + '/assets/pdftrons',
30008
+ forceClientSideInit: true,
30009
+ streaming: true,
30010
+ licenseKey: this.environment.pdftronLicenceKey,
30011
+ css: this.isArabic
30012
+ ? this.baseHref + '/assets/styles/ar-mypdftron.css'
30013
+ : this.baseHref + '/assets/styles/en-mypdftron.css',
30014
+ annotationUser: this.nuxeo.nuxeoClient.user.properties.firstName + ' ' + this.nuxeo.nuxeoClient.user.properties.lastName,
30015
+ disabledElements: ['downloadButton', 'printButton']
30016
+ }, this.viewerRef.nativeElement).then(function (instance) { return __awaiter(_this, void 0, void 0, function () {
30017
+ return __generator(this, function (_b) {
30018
+ __classPrivateFieldGet(this, _PdftronComponent_instances, "m", _PdftronComponent_afterLoadWebViewer).call(this, instance);
30019
+ return [2 /*return*/];
30020
+ });
30021
+ }); });
30022
+ _c.label = 3;
30023
+ case 3: return [2 /*return*/];
30024
+ }
29940
30025
  });
29941
30026
  });
29942
30027
  };
@@ -29955,8 +30040,8 @@
29955
30040
  // exctract all anotations on the file and send it out side to be saved and leave the file as it is without any anotations on it
29956
30041
  PdftronComponent.prototype.exportAnotationsToOutside = function () {
29957
30042
  var _this = this;
29958
- this.webViewerInstance.annotManager.on('annotationChanged', function (annotations, action, _a) {
29959
- var imported = _a.imported;
30043
+ this.webViewerInstance.annotManager.on('annotationChanged', function (annotations, action, _b) {
30044
+ var imported = _b.imported;
29960
30045
  if (imported)
29961
30046
  return;
29962
30047
  _this.webViewerInstance.annotManager.exportAnnotations().then(function (exctractedAnotations) {
@@ -29990,7 +30075,6 @@
29990
30075
  }
29991
30076
  _this.firstSignatureLoad = false;
29992
30077
  });
29993
- ;
29994
30078
  };
29995
30079
  PdftronComponent.prototype.exportingSignature = function () {
29996
30080
  var _this = this;
@@ -30003,11 +30087,10 @@
30003
30087
  console.log(annotation);
30004
30088
  }
30005
30089
  });
30006
- ;
30007
30090
  };
30008
30091
  PdftronComponent.prototype.extractAnotation = function (annotation, documentViewer) {
30009
30092
  if (annotation['image']) {
30010
- // convert base64 signature into file and emit it to out side
30093
+ // convert base64 signature into file and emit it to out side
30011
30094
  var base64Img = annotation['image']['currentSrc'];
30012
30095
  var arr = base64Img.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
30013
30096
  while (n--) {
@@ -30025,7 +30108,7 @@
30025
30108
  return __awaiter(this, void 0, void 0, function () {
30026
30109
  var canvas, pageMatrix, ctx;
30027
30110
  var _this = this;
30028
- return __generator(this, function (_a) {
30111
+ return __generator(this, function (_b) {
30029
30112
  canvas = document.createElement('canvas');
30030
30113
  pageMatrix = docViewer.getDocument().getPageMatrix(annotation.PageNumber);
30031
30114
  // Set the height & width of the canvas to madeleteSavedSignaturetch the annotation
@@ -30059,16 +30142,19 @@
30059
30142
  };
30060
30143
  PdftronComponent.prototype.addDownloadButton = function () {
30061
30144
  var _this = this;
30062
- if (this.allowDownloadSecretFile || (!this.allowDownloadSecretFile && this.correspondance.properties[this.secrecyProperty] && this.correspondance.properties[this.secrecyProperty] === 'Normal')) {
30145
+ if (this.allowDownloadSecretFile ||
30146
+ (!this.allowDownloadSecretFile &&
30147
+ this.correspondance.properties[this.secrecyProperty] &&
30148
+ this.correspondance.properties[this.secrecyProperty] === 'Normal')) {
30063
30149
  this.webViewerInstance.setHeaderItems(function (header) {
30064
30150
  header.push({
30065
30151
  type: 'actionButton',
30066
30152
  img: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-file-earmark-arrow-down" viewBox="0 0 16 16"> <path d="M8.5 6.5a.5.5 0 0 0-1 0v3.793L6.354 9.146a.5.5 0 1 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0-.708-.708L8.5 10.293V6.5z"/> <path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2zM9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5v2z"/></svg>',
30067
30153
  title: _this.isArabic ? 'تنزيل' : 'Download',
30068
30154
  onClick: function () { return __awaiter(_this, void 0, void 0, function () {
30069
- var _a, DocumentViewer, AnnotationManager, SaveOptions, saveOptions, options;
30070
- return __generator(this, function (_b) {
30071
- _a = this.webViewerInstance.CoreControls, DocumentViewer = _a.DocumentViewer, AnnotationManager = _a.AnnotationManager, SaveOptions = _a.SaveOptions;
30155
+ var _b, DocumentViewer, AnnotationManager, SaveOptions, saveOptions, options;
30156
+ return __generator(this, function (_c) {
30157
+ _b = this.webViewerInstance.CoreControls, DocumentViewer = _b.DocumentViewer, AnnotationManager = _b.AnnotationManager, SaveOptions = _b.SaveOptions;
30072
30158
  saveOptions = SaveOptions;
30073
30159
  options = {
30074
30160
  filename: this.correspondance.title ? this.correspondance.title : 'myDocument.pdf',
@@ -30080,30 +30166,31 @@
30080
30166
  this.events.next('download');
30081
30167
  return [2 /*return*/];
30082
30168
  });
30083
- }); },
30169
+ }); }
30084
30170
  });
30085
30171
  });
30086
30172
  }
30087
30173
  };
30088
30174
  PdftronComponent.prototype.addPrintButton = function () {
30089
30175
  var _this = this;
30090
- if (this.allowPrintSecretFile || (!this.allowPrintSecretFile && this.correspondance.properties[this.secrecyProperty] && this.correspondance.properties[this.secrecyProperty] === 'Normal')) {
30176
+ if (this.allowPrintSecretFile ||
30177
+ (!this.allowPrintSecretFile &&
30178
+ this.correspondance.properties[this.secrecyProperty] &&
30179
+ this.correspondance.properties[this.secrecyProperty] === 'Normal')) {
30091
30180
  this.webViewerInstance.setHeaderItems(function (header) {
30092
30181
  header.push({
30093
30182
  type: 'actionButton',
30094
30183
  img: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.cls-1{fill:#abb0c4;}</style></defs><title>icon - header - print - line</title><path class="cls-1" d="M20,6H18V2H6V6H4A2,2,0,0,0,2,8v9a2,2,0,0,0,2,2H6v3H18V19h2a2,2,0,0,0,2-2V8A2,2,0,0,0,20,6ZM8,4h8V6H8Zm8,16H8V16h8Zm4-3H18V14H6v3H4V8H20Zm-4-7h2v2H16Zm-3,0h2v2H13Z"></path></svg>',
30095
- title: _this.isArabic ? "طباعة" : 'Print',
30184
+ title: _this.isArabic ? 'طباعة' : 'Print',
30096
30185
  onClick: function () {
30097
30186
  _this.pdftronService.instance.print();
30098
30187
  _this.events.next('print');
30099
- },
30188
+ }
30100
30189
  });
30101
30190
  });
30102
30191
  }
30103
30192
  else {
30104
- this.webViewerInstance.disableElements([
30105
- 'printModal',
30106
- ]);
30193
+ this.webViewerInstance.disableElements(['printModal']);
30107
30194
  }
30108
30195
  };
30109
30196
  PdftronComponent.prototype.addWatermark = function () {
@@ -30115,21 +30202,11 @@
30115
30202
  );
30116
30203
  };
30117
30204
  PdftronComponent.prototype.loadDocument = function () {
30118
- var _this = this;
30119
30205
  if (!this.webViewerInstance || (!this.fileData && !this.fileURL)) {
30120
30206
  return;
30121
30207
  }
30122
- var _a = this.webViewerInstance, docViewer = _a.docViewer, annotManager = _a.annotManager, Annotations = _a.Annotations;
30123
- docViewer.on('documentLoaded', function () {
30124
- var fitMode = _this.webViewerInstance.FitMode.FitWidth;
30125
- if (_this.fitMode === 'FitPage') {
30126
- fitMode = _this.webViewerInstance.FitMode.FitPage;
30127
- }
30128
- else if (_this.fitMode === 'Zoom') {
30129
- fitMode = _this.webViewerInstance.FitMode.Zoom;
30130
- }
30131
- _this.webViewerInstance.setFitMode(fitMode);
30132
- });
30208
+ var _b = this.webViewerInstance, docViewer = _b.docViewer, annotManager = _b.annotManager, Annotations = _b.Annotations;
30209
+ docViewer.on('documentLoaded', __classPrivateFieldGet(this, _PdftronComponent_docLoaded, "f"));
30133
30210
  if (!this.editMode) {
30134
30211
  this.webViewerInstance.annotManager.setReadOnly(true);
30135
30212
  // instance.enableTools([]);
@@ -30138,24 +30215,25 @@
30138
30215
  this.webViewerInstance.loadDocument(this.fileURL, {
30139
30216
  xodstreaming: true,
30140
30217
  customHeaders: {
30141
- Authorization: this.authHeader,
30142
- },
30218
+ Authorization: this.authHeader
30219
+ }
30143
30220
  // withCredentials: true,
30144
30221
  });
30145
30222
  }
30146
30223
  else {
30147
30224
  this.webViewerInstance.loadDocument(new Blob([new Uint8Array(this.fileData)], { type: this.DOCUMENT_TYPE }), {
30148
- filename: this.fileTitle,
30225
+ filename: this.fileTitle
30149
30226
  });
30150
30227
  }
30151
30228
  this.isFetching = false;
30152
30229
  // if not negelcting adding water mark then check conditions for adding it
30153
30230
  if (!this.negelectAddingWaterMark) {
30154
30231
  if (this.correspondance !== undefined) {
30155
- // if we need to check on secrecy level for adding water mark or not
30232
+ // if we need to check on secrecy level for adding water mark or not
30156
30233
  if (this.environment.enableViewerWaterMark && this.secrecyProperty) {
30157
30234
  // check for secrecy level befor adding watermark
30158
- if (this.correspondance.properties[this.secrecyProperty] && this.correspondance.properties[this.secrecyProperty] !== 'Normal') {
30235
+ if (this.correspondance.properties[this.secrecyProperty] &&
30236
+ this.correspondance.properties[this.secrecyProperty] !== 'Normal') {
30159
30237
  this.addWatermark();
30160
30238
  }
30161
30239
  }
@@ -30169,19 +30247,19 @@
30169
30247
  PdftronComponent.prototype.exportAsBlob = function () {
30170
30248
  return __awaiter(this, void 0, void 0, function () {
30171
30249
  var doc, xfdfString, data, arr, blob;
30172
- return __generator(this, function (_a) {
30173
- switch (_a.label) {
30250
+ return __generator(this, function (_b) {
30251
+ switch (_b.label) {
30174
30252
  case 0:
30175
30253
  doc = this.webViewerInstance.docViewer.getDocument();
30176
30254
  return [4 /*yield*/, this.webViewerInstance.annotManager.exportAnnotations()];
30177
30255
  case 1:
30178
- xfdfString = _a.sent();
30256
+ xfdfString = _b.sent();
30179
30257
  return [4 /*yield*/, doc.getFileData({
30180
30258
  // saves the document with annotations in it
30181
- xfdfString: xfdfString,
30259
+ xfdfString: xfdfString
30182
30260
  })];
30183
30261
  case 2:
30184
- data = _a.sent();
30262
+ data = _b.sent();
30185
30263
  arr = new Uint8Array(data);
30186
30264
  blob = new Blob([arr], { type: this.DOCUMENT_TYPE });
30187
30265
  return [2 /*return*/, Promise.resolve(blob)];
@@ -30196,7 +30274,7 @@
30196
30274
  'toolbarGroup-Shapes',
30197
30275
  'toolbarGroup-Edit',
30198
30276
  'toolbarGroup-Insert',
30199
- 'toolbarGroup-Annotate',
30277
+ 'toolbarGroup-Annotate'
30200
30278
  ]);
30201
30279
  this.webViewerInstance.annotManager.setReadOnly(true);
30202
30280
  }
@@ -30207,20 +30285,14 @@
30207
30285
  'toolbarGroup-Shapes',
30208
30286
  'toolbarGroup-Edit',
30209
30287
  'toolbarGroup-Insert',
30210
- 'toolbarGroup-Annotate',
30288
+ 'toolbarGroup-Annotate'
30211
30289
  ]);
30212
30290
  var group = void 0;
30213
30291
  if (this.editingType === 'signDoc') {
30214
- this.webViewerInstance.enableElements([
30215
- 'toolbarGroup-Insert'
30216
- ]);
30292
+ this.webViewerInstance.enableElements(['toolbarGroup-Insert']);
30217
30293
  }
30218
30294
  else if (this.editingType === 'annotate') {
30219
- this.webViewerInstance.enableElements([
30220
- 'toolbarGroup-Shapes',
30221
- 'toolbarGroup-Edit',
30222
- 'toolbarGroup-Annotate',
30223
- ]);
30295
+ this.webViewerInstance.enableElements(['toolbarGroup-Shapes', 'toolbarGroup-Edit', 'toolbarGroup-Annotate']);
30224
30296
  }
30225
30297
  }
30226
30298
  else {
@@ -30228,7 +30300,7 @@
30228
30300
  'toolbarGroup-Shapes',
30229
30301
  'toolbarGroup-Edit',
30230
30302
  'toolbarGroup-Insert',
30231
- 'toolbarGroup-Annotate',
30303
+ 'toolbarGroup-Annotate'
30232
30304
  ]);
30233
30305
  }
30234
30306
  this.webViewerInstance.annotManager.setReadOnly(false);
@@ -30240,11 +30312,9 @@
30240
30312
  this.toggleEdit();
30241
30313
  if (changes.urlFileContent &&
30242
30314
  changes.urlFileContent.previousValue &&
30243
- changes.urlFileContent.previousValue !==
30244
- changes.urlFileContent.currentValue) {
30315
+ changes.urlFileContent.previousValue !== changes.urlFileContent.currentValue) {
30245
30316
  this.ngOnDestroy();
30246
30317
  this.ngOnInit();
30247
- this.ngAfterViewInit();
30248
30318
  }
30249
30319
  }
30250
30320
  };
@@ -30257,9 +30327,9 @@
30257
30327
  // adding search lisner to lisen to internal search from ui and without ocr
30258
30328
  PdftronComponent.prototype.addSearchListner = function () {
30259
30329
  var _this = this;
30260
- var _a = this.webViewerInstance, annotManager = _a.annotManager, docViewer = _a.docViewer, Annotations = _a.Annotations;
30330
+ var _b = this.webViewerInstance, annotManager = _b.annotManager, docViewer = _b.docViewer, Annotations = _b.Annotations;
30261
30331
  var searchListener = function (searchPattern, options, results) {
30262
- var _a;
30332
+ var _b;
30263
30333
  _this.mySearchStringResults = [];
30264
30334
  if (_this.savedAnotations.length > 0) {
30265
30335
  _this.savedAnotations.map(function (annotation) {
@@ -30279,7 +30349,7 @@
30279
30349
  annotation.Author = _this.webViewerInstance.annotManager.getCurrentUser();
30280
30350
  return annotation;
30281
30351
  });
30282
- (_a = _this.savedAnotations).push.apply(_a, __spreadArray([], __read(_this.newAnnotations)));
30352
+ (_b = _this.savedAnotations).push.apply(_b, __spreadArray([], __read(_this.newAnnotations)));
30283
30353
  annotManager.addAnnotations(_this.newAnnotations);
30284
30354
  annotManager.drawAnnotationsFromList(_this.newAnnotations);
30285
30355
  }
@@ -30291,14 +30361,16 @@
30291
30361
  _this.webViewerInstance.addSearchListener(searchListener);
30292
30362
  });
30293
30363
  };
30294
- // perform automatic search when intering the page
30364
+ // perform automatic search when intering the page
30295
30365
  PdftronComponent.prototype.automaticSearch = function (searchTextArray) {
30296
30366
  var _this = this;
30297
- var _a = this.webViewerInstance, annotManager = _a.annotManager, docViewer = _a.docViewer, Annotations = _a.Annotations;
30367
+ var _b = this.webViewerInstance, annotManager = _b.annotManager, docViewer = _b.docViewer, Annotations = _b.Annotations;
30298
30368
  var searchOptions;
30299
30369
  this.webViewerInstance.openElements(['searchPanel']);
30300
30370
  docViewer.on('documentLoaded', function () {
30301
- var mode = _this.webViewerInstance.CoreControls.Search.Mode.PAGE_STOP | _this.webViewerInstance.CoreControls.Search.Mode.HIGHLIGHT | _this.webViewerInstance.CoreControls.Search.Mode.AMBIENT_STRING;
30371
+ var mode = _this.webViewerInstance.CoreControls.Search.Mode.PAGE_STOP |
30372
+ _this.webViewerInstance.CoreControls.Search.Mode.HIGHLIGHT |
30373
+ _this.webViewerInstance.CoreControls.Search.Mode.AMBIENT_STRING;
30302
30374
  _this.mySearchStringResults = []; // empty my search result when starting new search
30303
30375
  if (_this.fileWithOcr) {
30304
30376
  // add redaction annotation for each search result
@@ -30310,13 +30382,13 @@
30310
30382
  _this.pages.pages.forEach(function (page, index) {
30311
30383
  _this.pageHeight = page.page_height;
30312
30384
  _this.pageWidth = page.page_width;
30313
- _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight((index + 1));
30314
- _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth((index + 1));
30385
+ _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight(index + 1);
30386
+ _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth(index + 1);
30315
30387
  page.zones.forEach(function (zone) {
30316
30388
  zone.paragraphs.forEach(function (paragraph) {
30317
30389
  paragraph.lines.forEach(function (line) {
30318
30390
  if (line.text.includes(searchText)) {
30319
- _this.SearchForWordInLine(mySearch, line, (index + 1), page);
30391
+ _this.SearchForWordInLine(mySearch, line, index + 1, page);
30320
30392
  }
30321
30393
  });
30322
30394
  });
@@ -30324,7 +30396,7 @@
30324
30396
  });
30325
30397
  }
30326
30398
  else {
30327
- // then i am searching with only one word
30399
+ // then i am searching with only one word
30328
30400
  _this.searchForWordInAllPages(searchText);
30329
30401
  }
30330
30402
  });
@@ -30358,32 +30430,34 @@
30358
30430
  }
30359
30431
  });
30360
30432
  };
30361
- // search for single word in all pages
30433
+ // search for single word in all pages
30362
30434
  PdftronComponent.prototype.searchForWordInAllPages = function (searchedWord) {
30363
30435
  var _this = this;
30364
30436
  this.pages.pages.forEach(function (page, index) {
30365
30437
  _this.pageHeight = page.page_height;
30366
30438
  _this.pageWidth = page.page_width;
30367
- _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight((index + 1));
30368
- _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth((index + 1));
30369
- var x = (_this.pageWidth / _this.standardWidth); // width ratio
30370
- var y = (_this.pageHeight / _this.standardHeight); // height ratio
30439
+ _this.standardHeight = _this.webViewerInstance.docViewer.getPageHeight(index + 1);
30440
+ _this.standardWidth = _this.webViewerInstance.docViewer.getPageWidth(index + 1);
30441
+ var x = _this.pageWidth / _this.standardWidth; // width ratio
30442
+ var y = _this.pageHeight / _this.standardHeight; // height ratio
30371
30443
  page.zones.forEach(function (zone) {
30372
30444
  zone.paragraphs.forEach(function (paragraph) {
30373
30445
  paragraph.lines.forEach(function (line) {
30374
30446
  line.words.forEach(function (word) {
30375
30447
  if (word.text.includes(searchedWord)) {
30376
30448
  // annotation.PageNumber = index+1;
30377
- var quads = [{
30378
- x1: (word.coordinates.upper_left.x / x),
30379
- x2: (word.coordinates.bottom_right.x / x),
30380
- x3: (word.coordinates.bottom_right.x / x),
30381
- x4: (word.coordinates.upper_left.x / x),
30382
- y1: (word.coordinates.upper_left.y / y),
30383
- y2: (word.coordinates.upper_left.y / y),
30384
- y3: (word.coordinates.bottom_right.y / y),
30385
- y4: (word.coordinates.bottom_right.y / y),
30386
- }];
30449
+ var quads = [
30450
+ {
30451
+ x1: word.coordinates.upper_left.x / x,
30452
+ x2: word.coordinates.bottom_right.x / x,
30453
+ x3: word.coordinates.bottom_right.x / x,
30454
+ x4: word.coordinates.upper_left.x / x,
30455
+ y1: word.coordinates.upper_left.y / y,
30456
+ y2: word.coordinates.upper_left.y / y,
30457
+ y3: word.coordinates.bottom_right.y / y,
30458
+ y4: word.coordinates.bottom_right.y / y
30459
+ }
30460
+ ];
30387
30461
  _this.higlightText(quads, index + 1);
30388
30462
  _this.constructSearchResult(searchedWord, index + 1, quads, line.text);
30389
30463
  }
@@ -30393,14 +30467,14 @@
30393
30467
  });
30394
30468
  });
30395
30469
  };
30396
- // search for word in single line
30470
+ // search for word in single line
30397
30471
  PdftronComponent.prototype.SearchForWordInLine = function (listOfSearchedWords, line, pagenumber, page) {
30398
30472
  this.pageHeight = page.page_height;
30399
30473
  this.pageWidth = page.page_width;
30400
- this.standardHeight = this.webViewerInstance.docViewer.getPageHeight((pagenumber));
30401
- this.standardWidth = this.webViewerInstance.docViewer.getPageWidth((pagenumber));
30402
- var x = (this.pageWidth / this.standardWidth); // width ratio
30403
- var y = (this.pageHeight / this.standardHeight); // height ratio
30474
+ this.standardHeight = this.webViewerInstance.docViewer.getPageHeight(pagenumber);
30475
+ this.standardWidth = this.webViewerInstance.docViewer.getPageWidth(pagenumber);
30476
+ var x = this.pageWidth / this.standardWidth; // width ratio
30477
+ var y = this.pageHeight / this.standardHeight; // height ratio
30404
30478
  // find only words related to my search form the line
30405
30479
  var myFoundedResults = [];
30406
30480
  var correctResults = [];
@@ -30411,27 +30485,29 @@
30411
30485
  });
30412
30486
  // find only words exist in my search sentence and not single and repeated word
30413
30487
  myFoundedResults.map(function (result, index) {
30414
- if ((myFoundedResults[index]['wordIndex'] - 1 === (myFoundedResults[index - 1] && myFoundedResults[index - 1]['wordIndex'])) ||
30415
- (myFoundedResults[index + 1] && (myFoundedResults[index + 1]['wordIndex'] - 1 === myFoundedResults[index]['wordIndex']))) {
30488
+ if (myFoundedResults[index]['wordIndex'] - 1 ===
30489
+ (myFoundedResults[index - 1] && myFoundedResults[index - 1]['wordIndex']) ||
30490
+ (myFoundedResults[index + 1] &&
30491
+ myFoundedResults[index + 1]['wordIndex'] - 1 === myFoundedResults[index]['wordIndex'])) {
30416
30492
  correctResults.push(result);
30417
30493
  }
30418
30494
  });
30419
30495
  // highliht these words after eleminating all repeated and related words
30420
30496
  // must be for loop sp i can control the step in each loop
30421
30497
  var quads = [];
30422
- for (var i = 0; i < correctResults.length; (i = i + listOfSearchedWords.length)) {
30498
+ for (var i = 0; i < correctResults.length; i = i + listOfSearchedWords.length) {
30423
30499
  quads.push({
30424
- x1: (correctResults[((i + listOfSearchedWords.length) - 1)].word.coordinates.upper_left.x / x),
30425
- x2: (correctResults[i].word.coordinates.bottom_right.x / x),
30426
- x3: (correctResults[i].word.coordinates.bottom_right.x / x),
30427
- x4: (correctResults[((i + listOfSearchedWords.length) - 1)].word.coordinates.upper_left.x / x),
30428
- y1: (correctResults[i].word.coordinates.upper_left.y / y),
30429
- y2: (correctResults[((i + listOfSearchedWords.length) - 1)].word.coordinates.upper_left.y / y),
30430
- y3: (correctResults[((i + listOfSearchedWords.length) - 1)].word.coordinates.bottom_right.y / y),
30431
- y4: (correctResults[i].word.coordinates.bottom_right.y / y),
30500
+ x1: correctResults[i + listOfSearchedWords.length - 1].word.coordinates.upper_left.x / x,
30501
+ x2: correctResults[i].word.coordinates.bottom_right.x / x,
30502
+ x3: correctResults[i].word.coordinates.bottom_right.x / x,
30503
+ x4: correctResults[i + listOfSearchedWords.length - 1].word.coordinates.upper_left.x / x,
30504
+ y1: correctResults[i].word.coordinates.upper_left.y / y,
30505
+ y2: correctResults[i + listOfSearchedWords.length - 1].word.coordinates.upper_left.y / y,
30506
+ y3: correctResults[i + listOfSearchedWords.length - 1].word.coordinates.bottom_right.y / y,
30507
+ y4: correctResults[i].word.coordinates.bottom_right.y / y
30432
30508
  });
30433
30509
  this.higlightText(quads, pagenumber);
30434
- this.constructSearchResult(listOfSearchedWords.join(" "), pagenumber, quads, line.text);
30510
+ this.constructSearchResult(listOfSearchedWords.join(' '), pagenumber, quads, line.text);
30435
30511
  }
30436
30512
  };
30437
30513
  PdftronComponent.prototype.constructSearchResult = function (searchedText, pageNum, quads, line) {
@@ -30444,7 +30520,8 @@
30444
30520
  resultStrEnd: mySeearchedTextEndIndex,
30445
30521
  pageNum: pageNum,
30446
30522
  resultCode: 2,
30447
- quads: [{
30523
+ quads: [
30524
+ {
30448
30525
  ea: quads[0]['y3'],
30449
30526
  fa: quads[0]['y4'],
30450
30527
  ha: quads[0]['x1'],
@@ -30453,7 +30530,8 @@
30453
30530
  qB: quads[0]['x4'],
30454
30531
  rB: quads[0]['y1'],
30455
30532
  sB: quads[0]['y2']
30456
- }]
30533
+ }
30534
+ ]
30457
30535
  };
30458
30536
  this.mySearchStringResults.push(searchResultObject);
30459
30537
  console.log(this.mySearchStringResults);
@@ -30478,37 +30556,100 @@
30478
30556
  };
30479
30557
  // ------------------------------------------------------------------------ ------------------------------------------
30480
30558
  PdftronComponent.prototype.ngOnDestroy = function () {
30481
- if (this.webViewerInstance) {
30482
- this.webViewerInstance.closeDocument().then(function () {
30483
- console.log('document closed!');
30484
- });
30485
- this.pdftronService.instance = this.webViewerInstance = null;
30559
+ if (this.silentPdfTronService.isEnabled) {
30560
+ __classPrivateFieldGet(this, _PdftronComponent_instances, "m", _PdftronComponent_reset).call(this);
30561
+ }
30562
+ else {
30563
+ if (this.webViewerInstance) {
30564
+ this.webViewerInstance.closeDocument().then(function () {
30565
+ console.log('document closed!');
30566
+ });
30567
+ this.pdftronService.instance = this.webViewerInstance = null;
30568
+ }
30569
+ this.transelationSubscrition ? this.transelationSubscrition.unsubscribe() : null;
30486
30570
  }
30487
- this.transelationSubscrition ? this.transelationSubscrition.unsubscribe() : null;
30488
30571
  };
30489
30572
  return PdftronComponent;
30490
30573
  }());
30491
- PdftronComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PdftronComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: PdftronService }, { token: NuxeoService }, { token: i4.APP_BASE_HREF }, { token: SecurePipe }, { token: TranslationService }, { token: CustomToastrService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Component });
30492
- PdftronComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PdftronComponent, selector: "app-pdftron", inputs: { editMode: "editMode", actionClicked: "actionClicked", fileTitle: "fileTitle", docId: "docId", DOCUMENT_TYPE: "DOCUMENT_TYPE", fileData: "fileData", fitMode: "fitMode", authHeader: "authHeader", fileURL: "fileURL", correspondance: "correspondance", secrecyProperty: "secrecyProperty", editingType: "editingType", userSignatures: "userSignatures", searchString: "searchString", trackSignature: "trackSignature", useOutsideAnotations: "useOutsideAnotations", importedAnotations: "importedAnotations", allowDownloadSecretFile: "allowDownloadSecretFile", allowPrintSecretFile: "allowPrintSecretFile", negelectAddingWaterMark: "negelectAddingWaterMark" }, outputs: { onSignatureTracking: "onSignatureTracking", onAddingAnotation: "onAddingAnotation", events: "events", SignatureEvent: "SignatureEvent" }, providers: [SecurePipe], viewQueries: [{ propertyName: "viewerRef", first: true, predicate: ["fileViewer"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #fileViewer style=\"width: 100%; height: 100%;\"></div>\r\n", styles: [""] });
30574
+ _PdftronComponent_docLoaded = new WeakMap(), _PdftronComponent_instances = new WeakSet(), _PdftronComponent_updateSilentPdfTron = function _PdftronComponent_updateSilentPdfTron() {
30575
+ var rect = this.viewerRef.nativeElement.getBoundingClientRect();
30576
+ Object.assign(this.silentPdfTron.style, {
30577
+ position: 'absolute',
30578
+ top: rect.top + "px",
30579
+ left: rect.left + "px",
30580
+ width: rect.width + "px",
30581
+ height: rect.height + "px",
30582
+ zIndex: '9999',
30583
+ display: 'block'
30584
+ });
30585
+ }, _PdftronComponent_afterLoadWebViewer = function _PdftronComponent_afterLoadWebViewer(instance) {
30586
+ this.isArabic ? instance.setLanguage('ar') : instance.setLanguage('en');
30587
+ this.pdftronService.instance = this.webViewerInstance = instance;
30588
+ if (this.correspondance.facets.indexOf('ctocr') > -1) {
30589
+ this.fileWithOcr = true;
30590
+ this.pages = JSON.parse(this.correspondance.properties['ctocr:recognizedJson']);
30591
+ // override search funtion to use our search in ocr not defult search
30592
+ instance.overrideSearchExecution(this.searchFn);
30593
+ }
30594
+ else {
30595
+ // if no ocr then add search lisner to lisne to internal search and catch results
30596
+ this.addSearchListner();
30597
+ }
30598
+ this.addPrintButton();
30599
+ this.addDownloadButton();
30600
+ this.importSignature();
30601
+ this.exportingSignature();
30602
+ this.deleteAnnotation();
30603
+ this.exportingSavedSignature();
30604
+ if (this.useOutsideAnotations) {
30605
+ this.importAnotationsFromOutside();
30606
+ this.exportAnotationsToOutside();
30607
+ }
30608
+ this.webViewerInstance.docViewer.setSearchHighlightColors({
30609
+ // setSearchHighlightColors accepts both Annotations.Color objects or 'rgba' strings
30610
+ searchResult: new this.webViewerInstance.Annotations.Color(250, 206, 0, 0.50196),
30611
+ activeSearchResult: new this.webViewerInstance.Annotations.Color(250, 206, 0, 0.50196)
30612
+ });
30613
+ if (this.recivedSearchStringsArray.length !== 0) {
30614
+ this.automaticSearch(this.recivedSearchStringsArray);
30615
+ }
30616
+ this.loadDocument();
30617
+ }, _PdftronComponent_reset = function _PdftronComponent_reset() {
30618
+ var _a;
30619
+ this.webViewerInstance.closeDocument().then(function () {
30620
+ console.log('document closed!');
30621
+ });
30622
+ this.pdftronService.instance = null;
30623
+ this.transelationSubscrition ? this.transelationSubscrition.unsubscribe() : null;
30624
+ this.silentPdfTron.style.display = 'none';
30625
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
30626
+ this.webViewerInstance.setHeaderItems(function (header) {
30627
+ header.headers.default = header.headers.default.filter(function (q) { var _a; return !((_a = q.img) === null || _a === void 0 ? void 0 : _a.includes('<svg')); });
30628
+ });
30629
+ this.webViewerInstance.docViewer.off('documentLoaded', __classPrivateFieldGet(this, _PdftronComponent_docLoaded, "f"));
30630
+ // maybe will need to reset signature & annotations
30631
+ };
30632
+ PdftronComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PdftronComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: PdftronService }, { token: NuxeoService }, { token: i4.APP_BASE_HREF }, { token: TranslationService }, { token: SilentPdfTronService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Component });
30633
+ PdftronComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PdftronComponent, selector: "app-pdftron", inputs: { editMode: "editMode", actionClicked: "actionClicked", fileTitle: "fileTitle", docId: "docId", DOCUMENT_TYPE: "DOCUMENT_TYPE", fileData: "fileData", fitMode: "fitMode", authHeader: "authHeader", fileURL: "fileURL", correspondance: "correspondance", secrecyProperty: "secrecyProperty", editingType: "editingType", userSignatures: "userSignatures", searchString: "searchString", trackSignature: "trackSignature", useOutsideAnotations: "useOutsideAnotations", importedAnotations: "importedAnotations", allowDownloadSecretFile: "allowDownloadSecretFile", allowPrintSecretFile: "allowPrintSecretFile", negelectAddingWaterMark: "negelectAddingWaterMark" }, outputs: { onSignatureTracking: "onSignatureTracking", onAddingAnotation: "onAddingAnotation", events: "events", SignatureEvent: "SignatureEvent" }, providers: [SecurePipe], viewQueries: [{ propertyName: "viewerRef", first: true, predicate: ["fileViewer"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #fileViewer style=\"width: 100%; height: 100%;\"></div>\r\n", styles: [""] });
30493
30634
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PdftronComponent, decorators: [{
30494
30635
  type: i0.Component,
30495
30636
  args: [{
30496
30637
  selector: 'app-pdftron',
30497
30638
  templateUrl: './pdftron.component.html',
30498
30639
  styleUrls: ['./pdftron.component.scss'],
30499
- providers: [SecurePipe],
30640
+ providers: [SecurePipe]
30500
30641
  }]
30501
30642
  }], ctorParameters: function () {
30502
30643
  return [{ type: i0__namespace.ChangeDetectorRef }, { type: PdftronService }, { type: NuxeoService }, { type: undefined, decorators: [{
30503
30644
  type: i0.Inject,
30504
30645
  args: [i4.APP_BASE_HREF]
30505
- }] }, { type: SecurePipe }, { type: TranslationService }, { type: CustomToastrService }, { type: undefined, decorators: [{
30646
+ }] }, { type: TranslationService }, { type: SilentPdfTronService }, { type: undefined, decorators: [{
30506
30647
  type: i0.Inject,
30507
30648
  args: ['environment']
30508
30649
  }] }];
30509
30650
  }, propDecorators: { viewerRef: [{
30510
30651
  type: i0.ViewChild,
30511
- args: ['fileViewer']
30652
+ args: ['fileViewer', { static: true }]
30512
30653
  }], editMode: [{
30513
30654
  type: i0.Input
30514
30655
  }], actionClicked: [{
@@ -35998,6 +36139,7 @@
35998
36139
  exports.SharedDocsService = SharedDocsService;
35999
36140
  exports.SharedServicesModule = SharedServicesModule;
36000
36141
  exports.SidepanelComponent = SidepanelComponent;
36142
+ exports.SilentPdfTronService = SilentPdfTronService;
36001
36143
  exports.SingleActivityComponent = SingleActivityComponent;
36002
36144
  exports.Socket = Socket;
36003
36145
  exports.SpellCheckerFieldModule = SpellCheckerFieldModule;