@syncfusion/ej2-pdfviewer 17.3.49-4568 → 17.3.50-4568

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.
@@ -17998,9 +17998,6 @@ var PdfViewerBase = /** @class */ (function () {
17998
17998
  */
17999
17999
  // eslint-disable-next-line
18000
18000
  this.zoomInterval = 5;
18001
- /**
18002
- * @private
18003
- */
18004
18001
  /**
18005
18002
  * EJ2CORE-813 - This flag is represent current device is 'iPad' or 'iPhone' or'iPod' device.
18006
18003
  * @private
@@ -18018,6 +18015,8 @@ var PdfViewerBase = /** @class */ (function () {
18018
18015
  // tslint:disable-next-line
18019
18016
  this.previousContainerHeight = 0;
18020
18017
  this.isGotoPageEnabled = false;
18018
+ this.taggedTextHandler = null;
18019
+ this.taggedCollection = [];
18021
18020
  this.clearSessionStorage = function () {
18022
18021
  var documentId = window.sessionStorage.getItem('hashId');
18023
18022
  var documentLiveCount = window.sessionStorage.getItem('documentLiveCount');
@@ -19124,6 +19123,7 @@ var PdfViewerBase = /** @class */ (function () {
19124
19123
  this.pdfViewer = viewer;
19125
19124
  this.navigationPane = new NavigationPane(this.pdfViewer, this);
19126
19125
  this.textLayer = new TextLayer(this.pdfViewer, this);
19126
+ this.taggedPdf = new TaggedPDF(this.pdfViewer, this);
19127
19127
  this.signatureModule = new Signature(this.pdfViewer, this);
19128
19128
  // tslint:disable-next-line:max-line-length
19129
19129
  this.isWebkitMobile = /Chrome/.test(navigator.userAgent) || /Google Inc/.test(navigator.vendor) || (navigator.userAgent.indexOf('Safari') !== -1);
@@ -19951,6 +19951,9 @@ var PdfViewerBase = /** @class */ (function () {
19951
19951
  if (this.renderedPagesList) {
19952
19952
  this.renderedPagesList = [];
19953
19953
  }
19954
+ if (this.taggedCollection) {
19955
+ this.taggedCollection = [];
19956
+ }
19954
19957
  if (this.pageContainer) {
19955
19958
  while (this.pageContainer.hasChildNodes()) {
19956
19959
  this.pageContainer.removeChild(this.pageContainer.lastChild);
@@ -21197,6 +21200,14 @@ var PdfViewerBase = /** @class */ (function () {
21197
21200
  if (this.pdfViewer.textSelectionModule && !this.isTextSelectionDisabled) {
21198
21201
  this.pdfViewer.textSelectionModule.applySelectionRangeOnScroll(pageIndex);
21199
21202
  }
21203
+ if (this.pdfViewer.taggedPDFModule && this.pdfViewer.enableTaggedPDF) {
21204
+ if (this.taggedCollection[pageIndex.toString()]) {
21205
+ this.renderTaggedTextContentsFromServer(pageIndex, this.taggedCollection[pageIndex.toString()]);
21206
+ }
21207
+ else {
21208
+ this.createRequestForTaggedText(pageIndex);
21209
+ }
21210
+ }
21200
21211
  if (this.documentAnnotationCollections) {
21201
21212
  var isAnnotationAdded = false;
21202
21213
  for (var i = 0; i < this.annotationRenderredList.length; i++) {
@@ -21391,6 +21402,33 @@ var PdfViewerBase = /** @class */ (function () {
21391
21402
  }
21392
21403
  }
21393
21404
  };
21405
+ PdfViewerBase.prototype.renderTaggedTextContentsFromServer = function (pageIndex, taggedTextResponse) {
21406
+ this.taggedPdf.renderTaggedTextContentsFromServer(pageIndex, taggedTextResponse);
21407
+ };
21408
+ PdfViewerBase.prototype.createRequestForTaggedText = function (pageIndex) {
21409
+ var jsonObject;
21410
+ var proxy = this;
21411
+ jsonObject = { action: 'RenderTaggedContent', elementId: this.pdfViewer.element.id, hashId: this.hashId, uniqueId: this.documentId, pageIndex: pageIndex };
21412
+ if (this.jsonDocumentId) {
21413
+ jsonObject.documentId = this.jsonDocumentId;
21414
+ }
21415
+ var url = this.pdfViewer.serviceUrl + '/' + "RenderTaggedContent";
21416
+ this.taggedTextHandler = new AjaxHandler(this.pdfViewer);
21417
+ this.taggedTextHandler.url = url;
21418
+ this.taggedTextHandler.mode = true;
21419
+ this.taggedTextHandler.responseType = 'text';
21420
+ this.taggedTextHandler.send(jsonObject);
21421
+ this.taggedTextHandler.onSuccess = function (result) {
21422
+ var data = JSON.parse(result.data);
21423
+ var pageData = data.filter(function (item) { return (item.PageNumber).toString() === pageIndex.toString(); });
21424
+ proxy.taggedCollection[pageIndex.toString()] = pageData;
21425
+ proxy.renderTaggedTextContentsFromServer(pageIndex, pageData);
21426
+ };
21427
+ this.taggedTextHandler.onFailure = function (result) {
21428
+ console.log("error");
21429
+ };
21430
+ };
21431
+
21394
21432
  PdfViewerBase.prototype.renderPageContainer = function (pageNumber, pageWidth, pageHeight, topValue) {
21395
21433
  // tslint:disable-next-line:max-line-length
21396
21434
  var pageDiv = createElement('div', { id: this.pdfViewer.element.id + '_pageDiv_' + pageNumber, className: 'e-pv-page-div', attrs: { 'tabindex': '0' } });
@@ -24692,6 +24730,9 @@ var TextLayer = /** @class */ (function () {
24692
24730
  textLayer = createElement('div', { id: this.pdfViewer.element.id + '_textLayer_' + pageNumber, className: 'e-pv-text-layer' });
24693
24731
  textLayer.style.width = pageWidth + 'px';
24694
24732
  textLayer.style.height = pageHeight + 'px';
24733
+ if (this.pdfViewer.taggedPDFModule && this.pdfViewer.enableTaggedPDF) {
24734
+ textLayer.setAttribute('aria-hidden', 'true');
24735
+ }
24695
24736
  pageDiv.appendChild(textLayer);
24696
24737
  }
24697
24738
  this.pdfViewerBase.applyElementStyles(textLayer, pageNumber);
@@ -27433,6 +27474,7 @@ var Magnification = /** @class */ (function () {
27433
27474
  * @private
27434
27475
  */
27435
27476
  Magnification.prototype.onDoubleTapMagnification = function () {
27477
+ var _this = this;
27436
27478
  if (this.pdfViewer.toolbarModule) {
27437
27479
  this.pdfViewer.toolbarModule.showToolbar(false);
27438
27480
  }
@@ -27452,6 +27494,7 @@ var Magnification = /** @class */ (function () {
27452
27494
  }
27453
27495
  this.calculateScrollValues(scrollValue);
27454
27496
  this.isTapToFitZoom = !this.isTapToFitZoom;
27497
+ setTimeout(function () { _this.isMagnified = false; }, 500);
27455
27498
  this.isDoubleTapZoom = false;
27456
27499
  }
27457
27500
  };
@@ -36142,6 +36185,20 @@ var PdfViewer = /** @class */ (function (_super) {
36142
36185
  enumerable: true,
36143
36186
  configurable: true
36144
36187
  });
36188
+ Object.defineProperty(PdfViewer.prototype, "taggedPdf", {
36189
+ /**
36190
+ * Gets the tagged layer object of the pdf viewer.
36191
+ *
36192
+ * @asptype TaggedPDF
36193
+ * @blazorType TaggedPDF
36194
+ * @returns { TaggedPDF }
36195
+ */
36196
+ get: function () {
36197
+ return this.taggedPDFModule;
36198
+ },
36199
+ enumerable: true,
36200
+ configurable: true
36201
+ });
36145
36202
  Object.defineProperty(PdfViewer.prototype, "toolbar", {
36146
36203
  /**
36147
36204
  * Gets the toolbar object of the pdf viewer.
@@ -36375,6 +36432,11 @@ var PdfViewer = /** @class */ (function (_super) {
36375
36432
  member: 'FormFields', args: [this, this.viewerBase]
36376
36433
  });
36377
36434
  }
36435
+ if (this.enableTaggedPDF) {
36436
+ modules.push({
36437
+ member: 'TaggedPDF', args: [this, this.viewerBase]
36438
+ });
36439
+ }
36378
36440
  return modules;
36379
36441
  };
36380
36442
  /**
@@ -37234,6 +37296,9 @@ var PdfViewer = /** @class */ (function (_super) {
37234
37296
  __decorate$2([
37235
37297
  Property(false)
37236
37298
  ], PdfViewer.prototype, "isExtractText", void 0);
37299
+ __decorate$2([
37300
+ Property(true)
37301
+ ], PdfViewer.prototype, "enableTaggedPDF", void 0);
37237
37302
  __decorate$2([
37238
37303
  Property({ showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] })
37239
37304
  ], PdfViewer.prototype, "toolbarSettings", void 0);
@@ -42093,6 +42158,204 @@ var FormFields = /** @class */ (function () {
42093
42158
  return FormFields;
42094
42159
  }());
42095
42160
 
42161
+ /**
42162
+ * export types
42163
+ */
42164
+
42165
+ /**
42166
+ * Tagged PDF module is used to handle tagged pdf document
42167
+ *
42168
+ * @hidden
42169
+ */
42170
+ var TaggedPDF = /** @class */ (function () {
42171
+ /**
42172
+ * @param {PdfViewer} pdfViewer - The PdfViewer.
42173
+ * @param {PdfViewerBase} pdfViewerBase - The PdfViewerBase.
42174
+ * @private
42175
+ */
42176
+ function TaggedPDF(pdfViewer, pdfViewerBase) {
42177
+ this.createTag = function (taggedTextResponse) {
42178
+ var _this = this;
42179
+ var tagType = taggedTextResponse.TagType;
42180
+ var parentTagType = taggedTextResponse.ParentTagType;
42181
+ var text = taggedTextResponse.Text;
42182
+ var altText = taggedTextResponse.AltText;
42183
+ var bounds = taggedTextResponse.Bounds;
42184
+ var childTags = taggedTextResponse.ChildElements;
42185
+ var textTag = document.createElement(this.getTag(tagType));
42186
+ textTag.style = "padding:0px;margin:0px";
42187
+ if (parentTagType != "Document" && parentTagType != "Part") {
42188
+ textTag.style.position = 'absolute';
42189
+ }
42190
+ if (bounds) {
42191
+ this.setStyleToTaggedTextDiv(textTag, bounds);
42192
+ this.setTextElementProperties(textTag);
42193
+ }
42194
+ if (text.trim() != "") {
42195
+ textTag.innerText = text;
42196
+ }
42197
+ if (altText && altText.trim() !== "" && (tagType === "Image" || tagType === "Figure")) {
42198
+ textTag.alt = altText;
42199
+ textTag.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=";
42200
+ }
42201
+ if (childTags && childTags.length > 0) {
42202
+ childTags.forEach(function (element) {
42203
+ if (tagType === "Table") {
42204
+ element.ChildElements.forEach(function (newelement) {
42205
+ textTag.appendChild(_this.createTag(newelement));
42206
+ });
42207
+ }
42208
+ else {
42209
+ textTag.appendChild(_this.createTag(element));
42210
+ }
42211
+ });
42212
+ }
42213
+ return textTag;
42214
+ };
42215
+ this.pdfViewer = pdfViewer;
42216
+ this.pdfViewerBase = pdfViewerBase;
42217
+ }
42218
+ TaggedPDF.prototype.addTaggedLayer = function (pageIndex) {
42219
+ var taggedLayer;
42220
+ if (this.pdfViewer.enableTaggedPDF) {
42221
+ var pageDiv = document.getElementById(this.pdfViewer.element.id + '_pageDiv_' + pageIndex);
42222
+ taggedLayer = document.getElementById(this.pdfViewer.element.id + '_taggedLayer_' + pageIndex);
42223
+ if (!taggedLayer) {
42224
+ taggedLayer = createElement('div', { id: this.pdfViewer.element.id + '_taggedLayer_' + pageIndex, className: 'e-pv-tagged-layer e-pv-text-layer' });
42225
+ }
42226
+ taggedLayer.innerHTML = "";
42227
+ taggedLayer.style.width = this.pdfViewerBase.pageSize[parseInt(pageIndex.toString(), 10)].width * this.pdfViewerBase.getZoomFactor() + 'px';
42228
+ taggedLayer.style.height = this.pdfViewerBase.pageSize[parseInt(pageIndex.toString(), 10)].height * this.pdfViewerBase.getZoomFactor() + 'px';
42229
+ taggedLayer.style.pointerEvents = "none";
42230
+ if (pageDiv) {
42231
+ pageDiv.appendChild(taggedLayer);
42232
+ }
42233
+ }
42234
+ return taggedLayer;
42235
+ };
42236
+ TaggedPDF.prototype.renderTaggedTextContentsFromServer = function (pageIndex, taggedTextResponse) {
42237
+ var taggedLayer = this.addTaggedLayer(pageIndex);
42238
+ for (var i = 0; i < taggedTextResponse.length; i++) {
42239
+ var textDiv = createElement('div', { id: this.pdfViewer.element.id + '_taggedText_' + pageIndex + '_' + i, className: 'e-pv-text', attrs: { 'tabindex': '-1' } });
42240
+ var bounds = taggedTextResponse[i].Bounds;
42241
+ if (taggedTextResponse[i].TagType === "Paragraph" && taggedTextResponse[i].ChildElements === null && taggedTextResponse[i].Text.trim() === "") {
42242
+ continue;
42243
+ }
42244
+ else {
42245
+ textDiv.appendChild(this.createTag(taggedTextResponse[i]));
42246
+ }
42247
+ textDiv.style.display = "inline";
42248
+ this.setStyleToTaggedTextDiv(textDiv, bounds);
42249
+ this.setTextElementProperties(textDiv);
42250
+ taggedLayer.appendChild(textDiv);
42251
+ }
42252
+ };
42253
+ TaggedPDF.prototype.getTag = function (tagType) {
42254
+ switch (tagType) {
42255
+ case "Paragraph":
42256
+ return "p";
42257
+ case "Figure":
42258
+ return "img";
42259
+ case "Article":
42260
+ return "art";
42261
+ case "Annotation":
42262
+ return "annot";
42263
+ case "BibliographyEntry":
42264
+ return "bibentry";
42265
+ case "BlockQuotation":
42266
+ return "blockQuote";
42267
+ case "Caption":
42268
+ return "caption";
42269
+ case "Code":
42270
+ return "code";
42271
+ case "Division":
42272
+ return "div";
42273
+ case "Document":
42274
+ return "document";
42275
+ case "Form":
42276
+ return "form";
42277
+ case "Formula":
42278
+ return "formula";
42279
+ case "Index":
42280
+ return "index";
42281
+ case "Heading":
42282
+ return "h";
42283
+ case "HeadingLevel1":
42284
+ return "h1";
42285
+ case "HeadingLevel2":
42286
+ return "h2";
42287
+ case "HeadingLevel3":
42288
+ return "h3";
42289
+ case "HeadingLevel4":
42290
+ return "h4";
42291
+ case "HeadingLevel5":
42292
+ return "h5";
42293
+ case "HeadingLevel6":
42294
+ return "h6";
42295
+ case "Label":
42296
+ return "label";
42297
+ case "Link":
42298
+ return "a";
42299
+ case "List":
42300
+ return "ul";
42301
+ case "ListItem":
42302
+ return "li";
42303
+ case "ListBody":
42304
+ return "p";
42305
+ case "Note":
42306
+ return "note";
42307
+ case "Part":
42308
+ return "part";
42309
+ case "Quotation":
42310
+ return "quote";
42311
+ case "Reference":
42312
+ return "reference";
42313
+ case "Section":
42314
+ return "sect";
42315
+ case "Span":
42316
+ return "span";
42317
+ case "Table":
42318
+ return "table";
42319
+ case "TableDataCell":
42320
+ return "td";
42321
+ case "TableHeader":
42322
+ return "th";
42323
+ case "TableOfContent":
42324
+ return "toc";
42325
+ case "TableOfContentItem":
42326
+ return "toci";
42327
+ case "TableRow":
42328
+ return "tr";
42329
+ case "Image":
42330
+ return "img";
42331
+ default:
42332
+ return "p";
42333
+ }
42334
+ };
42335
+
42336
+ TaggedPDF.prototype.setStyleToTaggedTextDiv = function (textDiv, bounds) {
42337
+ textDiv.style.left = bounds.X * (96 / 72) * this.pdfViewerBase.getZoomFactor() + 'px';
42338
+ textDiv.style.top = bounds.Y * (96 / 72) * this.pdfViewerBase.getZoomFactor() + 'px';
42339
+ textDiv.style.width = bounds.Width * (96 / 72) * this.pdfViewerBase.getZoomFactor() + 'px';
42340
+ var textHeight = bounds.Height * (96 / 72) * this.pdfViewerBase.getZoomFactor();
42341
+ textDiv.style.height = textHeight + 'px';
42342
+ textDiv.style.fontSize = 16 * this.pdfViewerBase.getZoomFactor() + 'px';
42343
+ textDiv.style.color = 'transparent';
42344
+ };
42345
+
42346
+ TaggedPDF.prototype.setTextElementProperties = function (textDiv) {
42347
+ textDiv.style.fontFamily = 'serif';
42348
+ textDiv.style.transformOrigin = '0%';
42349
+ };
42350
+ /**
42351
+ * @private
42352
+ */
42353
+ TaggedPDF.prototype.getModuleName = function () {
42354
+ return 'TaggedPDF';
42355
+ };
42356
+ return TaggedPDF;
42357
+ }());
42358
+
42096
42359
  /**
42097
42360
  * export types
42098
42361
  */
@@ -42109,5 +42372,5 @@ var FormFields = /** @class */ (function () {
42109
42372
  * export PDF viewer modules
42110
42373
  */
42111
42374
 
42112
- export { Annotation, LinkAnnotation, TextMarkupAnnotation, MeasureAnnotation, ShapeAnnotation, StampAnnotation, StickyNotesAnnotation, FreeTextAnnotation, InputElement, NavigationPane, PdfViewerBase, TextLayer, ContextMenu$1 as ContextMenu, FontStyle, AnnotationResizerLocation, CursorType, AjaxHandler, Signature, Magnification, Navigation, ThumbnailView, Toolbar$1 as Toolbar, AnnotationToolbar, ToolbarSettings, AjaxRequestSettings, CustomStampItem, AnnotationToolbarSettings, ServerActionSettings, StrikethroughSettings, UnderlineSettings, HighlightSettings, LineSettings, ArrowSettings, RectangleSettings, CircleSettings, ShapeLabelSettings, PolygonSettings, StampSettings, CustomStampSettings, DistanceSettings, PerimeterSettings, AreaSettings, RadiusSettings, VolumeSettings, StickyNotesSettings, MeasurementSettings, FreeTextSettings, AnnotationSelectorSettings, TextSearchColorSettings, HandWrittenSignatureSettings, AnnotationSettings, DocumentTextCollectionSettings, TextDataSettings, RectangleBounds, TileRenderingSettings, ScrollSettings, PdfViewer, BookmarkView, TextSelection, TextSearch, Print, FormFields, Drawing, findActiveElement, findObjectsUnderMouse, findObjectUnderMouse, CalculateLeaderPoints, findElementUnderMouse, insertObject, findTargetShapeElement, findObjects, findActivePage, ActiveElements, getConnectorPoints, getSegmentPath, updateSegmentElement, getSegmentElement, updateDecoratorElement, getDecoratorElement, clipDecorators, clipDecorator, initDistanceLabel, updateDistanceLabel, updateRadiusLabel, initPerimeterLabel, updatePerimeterLabel, removePerimeterLabel, updateCalibrateLabel, getPolygonPath, textElement, initLeaders, initLeader, isPointOverConnector, findNearestPoint, getDecoratorShape, renderAdornerLayer, createSvg, isLineShapes, setElementStype, findPointsLength, findPerimeterLength, getBaseShapeAttributes, getFunction, cloneObject, cloneArray, getInternalProperties, isLeader, PdfBounds, PdfFont, PdfAnnotationBase, ZOrderPageTable, Selector, ToolBase, SelectTool, MoveTool, StampTool, ConnectTool, ResizeTool, NodeDrawingTool, PolygonDrawingTool, LineTool, RotateTool };
42375
+ export { Annotation, LinkAnnotation, TextMarkupAnnotation, MeasureAnnotation, ShapeAnnotation, StampAnnotation, StickyNotesAnnotation, FreeTextAnnotation, InputElement, NavigationPane, PdfViewerBase, TextLayer, ContextMenu$1 as ContextMenu, FontStyle, AnnotationResizerLocation, CursorType, AjaxHandler, Signature, Magnification, Navigation, ThumbnailView, Toolbar$1 as Toolbar, AnnotationToolbar, ToolbarSettings, AjaxRequestSettings, CustomStampItem, AnnotationToolbarSettings, ServerActionSettings, StrikethroughSettings, UnderlineSettings, HighlightSettings, LineSettings, ArrowSettings, RectangleSettings, CircleSettings, ShapeLabelSettings, PolygonSettings, StampSettings, CustomStampSettings, DistanceSettings, PerimeterSettings, AreaSettings, RadiusSettings, VolumeSettings, StickyNotesSettings, MeasurementSettings, FreeTextSettings, AnnotationSelectorSettings, TextSearchColorSettings, HandWrittenSignatureSettings, AnnotationSettings, DocumentTextCollectionSettings, TextDataSettings, RectangleBounds, TileRenderingSettings, ScrollSettings, PdfViewer, BookmarkView, TextSelection, TextSearch, Print, FormFields, TaggedPDF, Drawing, findActiveElement, findObjectsUnderMouse, findObjectUnderMouse, CalculateLeaderPoints, findElementUnderMouse, insertObject, findTargetShapeElement, findObjects, findActivePage, ActiveElements, getConnectorPoints, getSegmentPath, updateSegmentElement, getSegmentElement, updateDecoratorElement, getDecoratorElement, clipDecorators, clipDecorator, initDistanceLabel, updateDistanceLabel, updateRadiusLabel, initPerimeterLabel, updatePerimeterLabel, removePerimeterLabel, updateCalibrateLabel, getPolygonPath, textElement, initLeaders, initLeader, isPointOverConnector, findNearestPoint, getDecoratorShape, renderAdornerLayer, createSvg, isLineShapes, setElementStype, findPointsLength, findPerimeterLength, getBaseShapeAttributes, getFunction, cloneObject, cloneArray, getInternalProperties, isLeader, PdfBounds, PdfFont, PdfAnnotationBase, ZOrderPageTable, Selector, ToolBase, SelectTool, MoveTool, StampTool, ConnectTool, ResizeTool, NodeDrawingTool, PolygonDrawingTool, LineTool, RotateTool };
42113
42376
  //# sourceMappingURL=ej2-pdfviewer.es5.js.map