js-pkg
Version:
Npm package of Syncfusion.JavaScript.
10 lines • 323 kB
JavaScript
/*!
* filename: ej.pdfviewer.min.js
* version : 15.3.0.33
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.globalize.min","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.scroller.min","./ej.button.min","./ej.dropdownlist.min","./ej.toolbar.min","./ej.tooltip.min","./ej.waitingpopup.min","./ej.checkbox.min","./ej.editor.min"],n):n()})(function(){(function(n,t,i){t.widget("ejPdfViewer","ej.PdfViewer",{_rootCSS:"e-pdfviewer",_requiresID:!0,element:null,model:null,validTags:["div"],defaults:{serviceUrl:"",hyperlinkOpenState:1,serverActionSettings:{load:"Load",fileUpload:"FileUpload",print:"Load",download:"Download"},documentPath:null,toolbarSettings:{toolbarItem:255,showTooltip:!0},enableHyperlink:!0,enableTextSelection:!0,pdfService:1,locale:"en-US",interactionMode:1,pageChange:"",documentLoad:"",hyperlinkClick:"",beforePrint:"",afterPrint:"",zoomchange:"",bufferStart:"",bufferEnd:"",annotationAdd:"",annotationRemove:"",annotationPropertiesChange:"",annotationResize:"",signatureDelete:"",signatureAdd:"",signatureResize:"",signaturePropertiesChange:"",isResponsive:!0,pageClick:"",allowClientBuffering:!1,documentUnload:"",ajaxRequestFailure:"",annotationType:null,enableTextMarkupAnnotations:!0,enableHighlightAnnotation:!0,enableStrikethroughAnnotation:!0,enableUnderlineAnnotation:!0,enableSignature:!0,shouldFlattenDocument:!1,strikethroughSettings:{color:"#ff0000",author:"Guest",opacity:1,subject:"Strikethrough",modifiedDate:null,isLocked:!1},underlineSettings:{color:"#00ff00",author:"Guest",opacity:1,subject:"Underline",modifiedDate:null,isLocked:!1},highlightSettings:{color:"#ffff00",author:"Guest",opacity:1,subject:"Highlight",modifiedDate:null,isLocked:!1},signatureSettings:{color:"#000000",opacity:1}},_isToolbarClick:!1,_curYPos:0,_curXPos:0,_curDown:!1,_pageModel:null,_currentPage:1,_zoomLevel:2,_preZoomVal:1,_fitType:null,_higherZoomIndex:0,_lowerZoomIndex:0,_actionUrl:null,_isDevice:!1,_contextMenu:!1,_zoomVal:1,_currentPageBackup:0,_zoomValBackup:0,_zoomLevelBackup:0,_fitTypeBackup:null,_scrollTop:0,_bgRenderTimer:0,_renderCount:0,_prevDiff:-1,_pointerCount:0,_searchText:null,_selectedIndex:0,_searchPageIndex:0,_isRenderedByPinch:!1,_isPinchLimitReached:!1,_isRerenderCanvasCreated:!1,_isPrinting:!1,_isContainImage:!1,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_isFindboxPresent:!1,_isTextSearch:!1,_isTextHighlighted:!1,_isRequestFired:!1,_isPageScrollHighlight:!1,_isPageScrolledForSearch:!1,_searchAjaxRequestState:null,_isPrevSearch:!1,_isMatchCase:!1,_isPrintHidden:!1,_isNavigationHidden:!1,_isMagnificationHidden:!1,_isDownloadHidden:!1,_isTextSearchHidden:!1,_isZoomCntlHidden:!1,_isDownloadCntlHidden:!1,_isToolbarHidden:!1,_isSignatureHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,_isWindowResizing:!1,_ejViewerInstance:null,_isAutoZoom:!1,_ejDropDownInstance:null,_clientx:null,_clienty:null,_curPosX:null,_curPosY:null,_previousBounds:null,_topValue:!1,_clearText:!1,_timers:null,_scrollMove:null,_rangePosition:null,_selectedRanges:null,_longTouch:!1,_ranges:!1,_touchcontextMenu:!1,_selectionNodes:null,_selectionRange:null,_touched:!1,_lockTimer:null,_timer:null,_displaySearch:!1,_isCopyRestrict:!1,_isPrintRestrict:!1,_isPageExtraction:!1,_isFormFieldsDisabled:!1,_isTargetPage:!1,_targetPage:0,_isBuffering:!1,_isBufferStart:!1,_pagesGot:null,_isPrintingProcess:!1,_isRequestSuccess:!1,_fileId:null,_isFormFields:!1,_imageObj:null,_isJsondataAvailable:!1,_highestWidth:0,_horizontalResolution:null,_isAsynchronousDownload:!0,_searchedText:null,_annotationActive:!1,_isHighlight:!1,_isUnderline:!1,_isStrikeout:!1,_drawColor:null,_selectedAnnotation:null,_selectedAnnotationObject:null,_isPopupNoteFocused:!1,_colorpickerObject:null,_toolbarColorpickerObject:null,_isBackwardSelection:!1,_isPropertiesWindowOpen:!1,_isAnnotationSelected:!1,_currentAnnotationRectangle:[],_currentAnnotationRectangleBackup:[],_annotationBackupNoteSave:[],_isPopupNoteVisible:!1,_isUnderlineEnabled:!1,_isHighlightEnabled:!1,_isStrikeOutEnabled:!1,_isContextMenuPresent:!1,_isDefaultColorSet:!1,_isTextSelection:!1,_colorPickerStatus:null,_annotationsDeletedNo:null,_selectedValue:null,_highestHeight:0,_removeSearch:!1,_ajaxInProgress:!1,_isNonBreackingCharacter:!1,_mouseDetection:!1,_oldX:null,_mouseX:null,_oldY:null,_mouseY:null,_newObject:[],_newx:null,_newy:null,_outputString:"",_completeSign:[],_outputPath:{},_valueChanges:{},_totalSignature:[],_isCanvasClicked:!1,_isCanasResized:!1,_tempCanvas:null,_previousZoomValue:1,_canvasTopPosition:0,_canvasLeftPosition:0,_newpoints:[],_maxpointsX:0,_minpointsX:0,_maxpointsY:0,_minpointsY:0,pageCount:0,currentPageNumber:1,zoomPercentage:100,fileName:null,isDocumentEdited:!1,_init:function(){var i,u;if(this._actionUrl=this.model.serviceUrl+"/"+this.model.serverActionSettings.load,this._renderViewer(),this._initViewer(),this._createContextMenu(),this._createHighlightContextMenu(),this._createWaterDropDiv(),this._createTouchContextMenu(),this._createPopupMenu(),this._createNote(),this._createPropertiesMenu(),this._createColorPalette(),this._createSignatureControl(),document.getElementById(this._id+"_pdfviewer_colorpicker").style.display="none",this._isToolbarColorPicker=!1,this._ejDropDownInstance=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),this._getPdfService(this.model.pdfService),this.model.serviceUrl){if(i={},i.viewerAction="GetPageModel",i.controlId=this._id,i.pageindex="1",i.isInitialLoading="true",this.model.documentPath){var r=this.model.documentPath,f=r.split("base64,")[1],e=!1,o=!1;f||(this.model.documentPath.indexOf("\\")!=-1||this.model.documentPath.indexOf("/")!=-1?(e=!0,o=!0,this.model.documentPath.toLowerCase().endsWith(".pdf")||(r=this.model.documentPath+".pdf")):(u=r.split(","),u.length>1?(i.newFileName=u[1],i.password=u[0]):i.newFileName=r,this._fileName=i.newFileName));i.file=r}i.id=this._createGUID();this._fileId=i.id;this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(i),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:i}),"_getPageModel")}this._printIframe=document.createElement("iframe")},_getPdfService:function(n){this._pdfService=n==1?t.PdfViewer.PdfService.Local:t.PdfViewer.PdfService.Remote},_initViewer:function(){this._wireEvents();this._initToolbar();this._currentPage=1;this._textMarkupAnnotationList=[];this._newAnnotationList=[];this._colorModifiedAnnotationList=[];this._existingAnnotationsModified=[];this._deletedAnnotationList=[];this._undoAnnotationCollection=[];this._redoAnnotationCollection=[];this._deletedAnnotationCollection=[];this._recentOperation=[];this._annotationsDeletedNo=[];this._redoActions=[];this._totalAnnotations=[];var i=this.model.toolbarSettings;i.templateId||(this._showToolbar(!0),this._showPrintButton(i.toolbarItem&t.PdfViewer.ToolbarItems.PrintTools),this._showZoomControl(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showFittoPage(i.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showPageNavigationControls(i.toolbarItem&t.PdfViewer.ToolbarItems.PageNavigationTools),this._showDownloadButton(i.toolbarItem&t.PdfViewer.ToolbarItems.DownloadTool),this._showTextSearchButton(i.toolbarItem&t.PdfViewer.ToolbarItems.TextSearchTool),this._showTextMarkupButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.TextMarkupAnnotationTools),this._showSignatureButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.SignatureTool),this._showSelectionButtons(i.toolbarItem&t.PdfViewer.ToolbarItems.SelectionTool));this._showViewerBlock(!1);this._setContainerSize();this._showloadingIndicator(!0);this._on(n("#"+this._id+"e-pdf-viewer"),"keydown",this._keyboardShortcutFind)},_unLoad:function(){var i,t;for(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomin"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoom"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotonext"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_gotoprevious"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_Print"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_download"),this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_search"),i=n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i._selectItemByIndex(0),i.disable(),clearTimeout(this._scrollTimer),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;this._renderedCanvasList&&(this._renderedCanvasList.length=0);this._showloadingIndicator(!1);this._showPageLoadingIndicator(!1);this._raiseClientEvent("documentUnload",null)},_destroy:function(){var t,i;for(this._isDestroyed=!0,n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),n("#"+this._id+"_txtpageNo").val(0),clearTimeout(this._scrollTimer),this._unwireEvents(),t=this._canvascount;t>=1;)n("#"+this._id+"pageDiv_"+t).remove(),n("#"+this._id+"selectioncanvas_"+t).remove(),t--;n("#"+this._id+"_PropertiesDialogTab").data("ejTab")._destroy();n("#"+this._id+"_signatureContainerDialogTab").data("ejDialog")._destroy();n("#"+this._id+"_pdfviewer_colorpicker").data("ejColorPicker")._destroy();n("#"+this._id+"_colorpicker").data("ejColorPicker")._destroy();n("#"+this._id+"_containerDialogTab").data("ejDialog")._destroy();n("#"+this._id+"_pdfviewer_colorpicker_Presets").parent().remove();n("#"+this._id+"_signatureContainerDialogTab").remove();n("#"+this._id+"_containerDialogTab").remove();n("#"+this._id+"_pageviewContainer").remove();n("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList")._destroy();n("#"+this._id+"_pdfviewer_searchbox").data("ejToolbar")._destroy();this._toolbar._destroy();n("#"+this._id+"_toolbarContainer").remove();n("#"+this._id+"_viewerContainer").remove();n("#"+this._id+"_viewBlockContainer").remove();n("#"+this._id+"_rptTooltip").remove();n("#"+this._id+"_loadingIndicator_WaitingPopup").remove();n("#"+this._id+"_viewerContainer_WaitingPopup").remove();n("#"+this._id+"_WaitingPopup").remove();n(this.element).find(".e-pdfviewer-viewer").remove();this.element.html("");i=n(this.element).clone();i.removeClass("e-pdfviewer e-js");this.element.replaceWith(i);this._renderedCanvasList.length=0;this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var n=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none","min-width":"200px",width:""},{id:this._id+"_rptTooltip"}),i=t.buildTag("span.e-pdfviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),r=t.buildTag("span.e-pdfviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});return n.append(i),n.append(r),n},_renderToolBar:function(i){var r,f,e,u,o,c,h,l,a,v,s;this.model.toolbarSettings.templateId?(s=document.getElementById(this.model.toolbarSettings.templateId),i.append(s),s.ejToolbar({enableSeparator:!0,height:s.height(),click:this.model.toolbarSettings.click,isResponsive:!0}),s.css("display","block")):(r=t.buildTag("div.e-pdfviewer-toolbarcontainer .e-pdfviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(r),this._isDevice?(f=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(f,"zoomin"),this._appendToolbarItems(f,"zoomout"),this._appendToolbarItems(f,"fitWidth"),this._appendToolbarItems(f,"fitPage"),r.append(f)):(e=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{}),this._appendToolbarItems(e,"gotoprevious"),this._appendToolbarItems(e,"gotonext"),this._appendToolbarItems(e,"gotopage"),r.append(e),u=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_zoomul"}),this._appendToolbarItems(u,"zoomin"),this._appendToolbarItems(u,"zoomout"),this._appendToolbarItems(u,"zoom"),this._appendToolbarItems(u,"fitWidth"),this._appendToolbarItems(u,"fitPage"),r.append(u),o=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_textmarkupul"}),this._appendToolbarItems(o,"underline"),this._appendToolbarItems(o,"strikeout"),this._appendToolbarItems(o,"highlight"),r.append(o),c=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_signatureul"}),this._appendToolbarItems(c,"signature"),r.append(c),h=t.buildTag("ul.e-pdfviewer-toolbarul","",{"padding-right":"10px"},{id:this._id+"_pdfviewer_selectul"}),this._appendToolbarItems(h,"selection"),this._appendToolbarItems(h,"scrolling"),r.append(h),l=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_downloadul"}),this._appendToolbarItems(l,"download"),r.append(l),a=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_printul"}),this._appendToolbarItems(a,"print"),r.append(a),v=t.buildTag("ul.e-pdfviewer-toolbarul","",{float:"right"},{id:this._id+"_pdfviewer_searchul"}),this._appendToolbarItems(v,"search"),r.append(v),n("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:0})),r.ejToolbar({enableSeparator:!this._isDevice,click:n.proxy(this._toolbarClick,this),itemHover:n.proxy(this._toolbarHover,this),isResponsive:!0,overflowClose:n.proxy(this._overflowToolbarClose,this)}),this._toolbar=n("#"+this._id+"_toolbarContainer").data("ejToolbar"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-responsive-toolbar").addClass("e-pdfviewer-responsivesecondarytoolbar"),n("#"+this._id+"_pdfviewer_searchul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_printul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_signatureul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_selectul").removeClass("e-separator"),n("#"+this._id+"_pdfviewer_downloadul").removeClass("e-separator"),n("#"+this._id+"_toolbarContainer_hiddenlist").removeClass("e-toolbarspan"))},_appendToolbarItems:function(n,i){var r,g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],h,c,l,a,v,y,p,w,b,k,d,e;switch(i){case"print":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"});h=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"});r.append(h);break;case"download":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_download"});c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-download","",{},{id:this._id+"_toolbar_download"});r.append(c);break;case"gotofirst":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"});l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{});r.append(l);break;case"gotolast":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"});a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{});r.append(a);break;case"gotonext":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"});v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{});r.append(v);break;case"gotoprevious":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"});y=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{});r.append(y);break;case"gotopage":r=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{id:this._id+"_pdfviewer_toolbar_pageli"});var o=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block",overflow:"visible"},{}),nt=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"}),tt=t.buildTag("span.e-pdfviewer-labelpageno","",{},{});o.append(nt);o.append(tt);r.append(o);break;case"zoomin":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"});p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"});r.append(p);break;case"zoomout":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"});w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"});r.append(w);break;case"zoom":r=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{id:this._id+"_pdfviewer_toolbar_zoomli"});var o=t.buildTag("div.e-pdfviewer-ejdropdownlist","",{},{id:this._id+"_pdfviewer_toolbar_zoom"}),u=t.buildTag("select.e-pdfviewer-tbdiv e-pdfviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"}),g=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale["default"],it=g.contextMenu.auto.contentText;u.append("<option Selected>"+it+"<\/option>");u.append("<option>50%<\/option>");u.append("<option>75%<\/option>");u.append("<option>100%<\/option>");u.append("<option>125%<\/option>");u.append("<option>150%<\/option>");u.append("<option>200%<\/option>");u.append("<option>400%<\/option>");o.append(u);r.append(o);break;case"fitWidth":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"});b=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"});r.append(b);break;case"fitPage":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"});k=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"});r.append(k);break;case"search":r=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_search"});d=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-find","",{},{id:this._id+"_find"});r.append(d);break;case"highlight":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-highlight","",{},{id:this._id+"_pdfviewer_toolbar_highlight"});var rt=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-highlight-markup","",{},{id:this._id+"_highlight_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_highlight_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_highlight_dropdown_arrow"});f.append(s);r.append(rt);r.append(f);break;case"underline":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-underline","",{},{id:this._id+"_pdfviewer_toolbar_underline"});var ut=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-underline-markup","",{},{id:this._id+"_underline_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_underline_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_underline_dropdown_arrow"});f.append(s);r.append(ut);r.append(f);break;case"strikeout":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-strikeout","",{},{id:this._id+"_pdfviewer_toolbar_strikeout"});var ft=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-strikeout-markup","",{},{id:this._id+"_strikeout_markup"}),f=t.buildTag("span.e-pdfviewer-dropdown-wrapper","",{},{id:this._id+"_strikeout_dropdown"}),s=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-dropdown-arrow","",{},{id:this._id+"_strikeout_dropdown_arrow"});f.append(s);r.append(ft);r.append(f);break;case"signature":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-sign","",{},{id:this._id+"_pdfviewer_toolbar_signature"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-sign","",{},{id:this._id+"_sign"});r.append(e);break;case"selection":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-select","",{},{id:this._id+"_pdfviewer_toolbar_select"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-select","",{},{id:this._id+"_select"});r.append(e);break;case"scrolling":r=t.buildTag("li.e-pdfviewer-toolbarli e-pdfviewer-toolbar-scroll","",{},{id:this._id+"_pdfviewer_toolbar_scroll"});e=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-scroll","",{},{id:this._id+"_scroll"});r.append(e)}n.append(r)},_renderViewerBlockinWeb:function(n){var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});n.append(i);var r=t.buildTag("table.e-pdfviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),u=t.buildTag("tr","",{width:"100%"}),f=t.buildTag("td.e-pdfviewer-viewerblockcontent","",{});return u.append(f),r.append(u),i.append(r),i},_renderViewerContainer:function(n){var r=t.buildTag("div","",{},{id:this._id+"_pdfviewerContainer"});n.append(r);var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-scrollcontainer e-pdfviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),u=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),f=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),e=t.buildTag("div","",{},{id:this._id+"_pageviewContainer"});return u.append(f),i.append(u),i.append(e),this._isDevice&&this._renderViewerBlockinDevice(i),r.append(i),r},_renderViewer:function(){var u=this.element.height(),f=this.element.width(),n=t.buildTag("div.e-pdfviewer-viewer","",{},{id:this._id+"e-pdf-viewer"}),i,r;this.element[0].style.height||this.element[0].parentElement.clientHeight==0||(this._isHeight=!0);this.element[0].style.width||this.element[0].parentElement.clientWidth==0||(this._isWidth=!0);u===0&&this.element[0].parentElement.clientHeight!=0&&this.element.height(this.element[0].parentElement.clientHeight);f===0&&this.element[0].parentElement.clientWidth!=0&&this.element.width(this.element[0].parentElement.clientWidth);this.element.append(n);this._renderToolBar(n);this._isDevice||(this._renderViewerBlockinWeb(n),i=this._renderToolTip());r=this._renderViewerContainer(n);r.append(i);this._renderSearchBox()},_renderSearchBox:function(){var r=t.buildTag("div.e-pdfviewer-searchbox e-pdfviewer-arrow","",{},{id:this._id+"_pdfviewer_searchbox"}),i=t.buildTag("ul.e-pdfviewer-toolbarul-search","",{}),l,v;r.append(i);var h=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{}),u=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-inputcontainer","",{},{}),y=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Find : ",{float:"left","padding-top":"1px","margin-right":"5px",width:"32px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{id:this._id+"_pdfviewer_findlabel"}),p=t.buildTag("input.e-pdfviewer-searchinput e-pdfviewer-elementalignments ejinputtext","",{width:"150px"},{id:this._id+"_pdfviewer_searchinput"});u.append(y);u.append(p);h.append(u);var f=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-previous","",{float:"left"},{id:this._id+"_pdfviewer_previous_search"}),e=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-next","",{float:"left"},{id:this._id+"_pdfviewer_next_search"}),c=t.buildTag("li.e-pdfviewer-toolbarli-search e-pdfviewer-search-close","",{float:"left","margin-left":"4px"},{id:this._id+"_pdfviewer_close_search"}),w=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-prevfind","",{},{id:this._id+"_prevfind"});f.append(w);n(f).css({"pointer-events":"none",opacity:"0.6"});n(e).css({"pointer-events":"none",opacity:"0.6"});l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-nextfind","",{},{id:this._id+"_nextfind"});e.append(l);var a=t.buildTag("li.e-pdfviewer-toolbarli-label","",{},{}),o=t.buildTag("div.e-pdfviewer-searchboxitem e-pdfviewer-search-checkboxcontainer","",{float:"left",overflow:"visible"},{}),s=t.buildTag("input","",{},{type:"checkbox"}),b=t.buildTag("span.e-pdfviewer-label e-pdfviewer-searchboxitem","Match case",{float:"left","padding-top":"3px","margin-left":"5px","margin-top":"4px",width:"70.5px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},{id:this._id+"_pdfviewer_matchlabel"});o.append(s);o.append(b);a.append(o);v=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-closefind","",{},{id:this._id+"_closefind"});c.append(v);i.append(h);i.append(f);i.append(e);i.append(a);i.append(c);r.ejToolbar({enableSeparator:!1,isResponsive:!1,width:"400px",hide:!0,itemHover:n.proxy(this._toolbarHover,this)});s.ejCheckBox({cssClass:"e-pdfviewer-match-checkbox",id:this._id+"_search_matchcase",size:t.CheckboxSize.Medium,change:n.proxy(this._matchcase,this)});s.ejCheckBox("disable");n("#"+this._id+"_pdfviewerContainer").append(r)},_createColorPalette:function(){var i=t.buildTag("div.e-pdfviewer-colorpicker","",{},{id:this._id+"_pdfviewer_colorpicker"});n("#"+this._id+"_pdfviewerContainer").append(i);i.ejColorPicker({displayInline:!0,modelType:"palette",change:n.proxy(this._setDrawColor,this)});this._toolbarColorpickerObject=i.data("ejColorPicker")},_setContainerSize:function(){var f=document.getElementById(this._id).clientHeight,i=0,t,r,u;this._isDevice||(t=n("#"+this._id+"_viewBlockContainer"),t.css("display").toLowerCase()=="block"&&(i=t.height()));r=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height();u=f-i-r-4;n("#"+this._id+"_viewerContainer").css({height:u+"px"})},_setPageSize:function(t,i,r){r=0;var f=n("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),u=this;this._renderPreviousPage=!1;n("#"+this._id+"_viewerContainer").unbind("scroll").on("scroll",function(){u._computeCurrentPage(t)});n("#"+this._id+"_pageviewContainer").mouseup(function(n){u._raiseClientEvent("pageClick",n)});this._scrollTimer=setInterval(function(){u._pageviewscrollchanged(t)},500);u._backgroundPage=1;this._previousZoom=1;u._previousPage=u._currentPage;this._pageLocation=[];this._renderedCanvasList=[];this._pageContents=[];this._pageText=[];this._textDivs=[];this._textContents=[];this._searchMatches=[];this._searchCollection=[];this._pageLocation[1]=0;this._searchedPages=[];this._canvascount=this._totalPages;this._pointers=[];this._imageObj=[];this._pagesGot=[];this._imageSrcCollection=[];this._selectionPages=[];this._designPageCanvas()},_designPageCanvas:function(){var o=5,l=n("#"+this._id+"_pageviewContainer"),c=n("#"+this._id+"_viewerContainer"),p=n("#"+this._id+"_pageviewOuterline"),a=c.width(),w=c.height(),v=this._pageWidth,b=this._pageHeight,s=1,i,h,e,y,r,f;for(s=(a-25)/v,s=Math.min(1,s),this._zoomVal=s,i=1;i<=this._totalPages;i++){h=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(this.element.width()-this._pageSize[i-1].PageHeight)/2:(this.element.width()-this._pageSize[i-1].PageWidth)/2;h<0&&(h=5);e=t.buildTag("div","",{},{id:this._id+"pageDiv_"+i});l.append(e);e.css("position","absolute");e.css("top",this._zoomVal*o);e.css("left",h+"px");this._pageLocation[i]=o;var u=document.createElement("canvas");u.id=this._id+"_secondarycanvas_"+i;u.className="e-pdfviewer-secondarycanvas";u.style.position="absolute";u.style.left=0;u.style.top=0;u.style.backgroundColor="transparent";e.append(u);y=this;r=document.createElement("canvas");r.id=this._id+"pagecanvas_"+i;r.className="e-pdfviewer-pageCanvas";this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?(r.width=this._zoomVal*this._pageSize[i-1].PageHeight,r.height=this._zoomVal*this._pageSize[i-1].PageWidth,r.style.height=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageHeight+"px"):(r.style.height=this._zoomVal*this._pageSize[i-1].PageHeight+"px",r.style.width=this._zoomVal*this._pageSize[i-1].PageWidth+"px",r.height=this._zoomVal*this._pageSize[i-1].PageHeight,r.width=this._zoomVal*this._pageSize[i-1].PageWidth);r.style.backgroundColor="white";e.append(r);u.height=r.height;u.width=r.width;u.style.height=r.height+"px";u.style.width=r.width+"px";f=document.createElement("div");f.id=this._id+"selectioncanvas_"+i;f.className="e-pdfviewer-selectiondiv";f.style.height=r.height+"px";f.style.width=r.width+"px";f.style.position="absolute";f.style.left=0;f.style.top=0;f.style.backgroundColor="transparent";f.style.zIndex="2";e.append(f);n("#"+this._id+"pageDiv_"+i).ejWaitingPopup({showOnInit:!0,appendTo:"#"+this._id+"pageDiv_"+i,target:"#"+this._id+"pageDiv_"+i});n("#"+this._id+"pageDiv_"+i+"_WaitingPopup").appendTo(n("#"+this._id+"pageDiv_"+i)).css({left:"0px",top:"0px","background-color":"#dbdbdb"});o=this._pageSize[i-1].PageRotation==90||this._pageSize[i-1].PageRotation==270?parseFloat(o)+parseFloat(this._pageSize[i-1].PageWidth)+8:parseFloat(o)+parseFloat(this._pageSize[i-1].PageHeight)+8}this._cummulativeHeight=o},_computeCurrentPage:function(){var u=0,t=0,c=document.getElementById(this._id+"_viewerContainer"),r=c.scrollTop,i;this._zoomVal!=1&&(r=r+this._currentPage*(8-this._zoomVal*8));var o=0,f=0,s={currentPageNumber:0};for(i=0;i<this._totalPages;i++){if(this._isDestroyed)return;if(u>r&&r>=0){t=i;var e=document.getElementById(this._id+"_viewerContainer"),l=n("#"+this._id+"pageDiv_"+t)[0],a=l.getBoundingClientRect(),v=a.bottom,y=n("#"+this._id+"e-pdf-viewer")[0],p=parseInt(y.getBoundingClientRect().height),w=this.model.toolbarSettings.templateId?n("#"+this.model.toolbarSettings.templateId).height():n("#"+this._id+"_toolbarContainer").height(),b=parseInt(n(e).css("height"))-w,k=p-b,h=parseFloat(u)-parseFloat(r),d=this.element[0].parentElement.clientHeight-h;this.element[0].parentElement.clientHeight<this._pageSize[i-1].PageHeight*this._zoomVal+this._pageSize[i].PageHeight*this._zoomVal&&parseInt(this._pageLocation[i]*this._zoomVal)<e.scrollTop&&d>h&&v<=290+k&&(t=parseFloat(t)+1,n("#"+this._id+"pageDiv_"+t).css("visibility",""),this._renderPreviousPage=!0);this._renderPreviousPage=!1;break}else u=this._pageSize[i].PageRotation==90||this._pageSize[i].PageRotation==270?parseFloat(u)+parseFloat(this._pageSize[i].PageWidth*this._zoomVal)+8:parseFloat(u)+parseFloat(this._pageSize[i].PageHeight*this._zoomVal)+8;t=r>=0?i+1:1}if(this._fitType=="fitToPage"){var g=parseFloat(n("#"+this._id+"pageDiv_"+t).css("height")),nt=this._pageLocation[t]*this._zoomVal,tt=parseFloat(n(e).css("height")),it=(tt-g)/2;n("#"+this._id+"pageDiv_"+t).css("top",nt+it+"px");n("#"+this._id+"pageDiv_"+(t+1)).css("visibility","hidden");n("#"+this._id+"pageDiv_"+(t-1)).css("visibility","hidden")}n("#"+this._id+"pageDiv_"+t).css("visibility","");n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages);o=document.getElementById(this._id+"_txtpageNo").value;n("#"+this._id+"_txtpageNo").val(t);this._updatePageNavigation(t,this._totalPages);f=document.getElementById(this._id+"_txtpageNo").value;s.currentPageNumber=f;this._currentPage=t;this.currentPageNumber=this._currentPage;o!=f&&this._raiseClientEvent("pageChange",s)},_pageviewscrollchanged:function(){var s=0,h=n("#"+this._id+"_viewerContainer").scrollTop(),c,o,f,l,r,e,u;this._isTargetPage&&this.model.allowClientBuffering&&(this._isTargetPage=!1,this._isBuffering=!0,this._targetPage<=this._totalPages&&(this._isBufferStart||(this._raiseClientEvent("bufferStart",this._isBuffering),this._isBufferStart=!0),c={viewerAction:this._viewerAction.getPageModel,pageindex:this._targetPage.toString(),enableOfflineMode:!0,isPageScrolled:"false"},u=this,this._ajaxRequestState=n.ajax({type:"POST",url:this.model.serviceUrl+"/"+this.model.serverActionSettings.load,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(c),traditional:!0,success:function(n){var f,e,r,t;if(jsondata=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),jsondata=jsondata.pdf,f=0,e=!1,jsondata){for(t=u._targetPage;t<=u._totalPages;t++)if(r=jsondata[t],r)u._pageContents[parseInt(r.currentpage)]=JSON.stringify(r),u._pageText[parseInt(r.currentpage)]=r.pageContents,u._pagesGot.push(parseInt(r.currentpage)),f++;else{e=!0;break}if(r==i&&!e)for(t=u._targetPage;t<=u._totalPages;t++)u._pagesGot.indexOf(t)&&f++;u._targetPage=f?u._targetPage+f:u._targetPage;u._targetPage>=u._totalPages&&(u._raiseClientEvent("bufferEnd",this._isBuffering),u._isBufferStart=!1);u._isTargetPage=!0;u._isBuffering=!1}},error:function(){}})));h==this._previousPosition&&(s=this._currentPage,this._totalPages&&this._previousPage!=s&&(o=parseInt(s),this._previousPage=s,o>=1&&o<=this._totalPages&&(this._isJsondataAvailable?(n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),n("#"+this._id+"_txtpageNo").val(o)):(this._showloadingIndicator(!0),n("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),n("#"+this._id+"_txtpageNo").val("0")),this._currentPage=o,this._updatePageNavigation(this._currentPage,this._totalPages),this._renderedCanvasList.indexOf(parseInt(this._currentPage))!=-1||this._scrollTriggered&&!this.model.allowClientBuffering||this._pageContents[parseInt(this._currentPage)]||this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))))));this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&this._currentPage<=this._totalPages&&(this._pageContents[parseInt(this._currentPage)]?(e=this._pageContents[parseInt(this._currentPage)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=this._currentPage.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));f=parseInt(this._currentPage)+1;this.model.allowClientBuffering?this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this.model.allowClientBuffering&&(r.isPageScrolled=!0),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this.model.allowClientBuffering&&(l=!0,this._isPrintingProcess||(r.isPageScrolled=!1)),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r),l):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages&&(this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r})))):this._renderedCanvasList.indexOf(parseInt(f))==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&f<=this._totalPages?this._pageContents[parseInt(f)]?(e=this._pageContents[parseInt(f)],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=f.toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&(!this._scrollTriggered||this.model.allowClientBuffering)&&parseInt(this._currentPage)-1>0&&(this._pageContents[parseInt(this._currentPage)-1]?(e=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(e)):this._scrollTriggered||(this._scrollTriggered=!0,r={},r.viewerAction=this._viewerAction.getPageModel,r.pageindex=(parseInt(this._currentPage)-1).toString(),r.id=this._fileId,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(r)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:r}))));this._previousPosition=h;u=this;setTimeout(function(){var f,e;if(n(".e-pdfviewer-formFields").show(),u.model){var o=t.PdfViewer.Locale[u.model.locale]?t.PdfViewer.Locale[u.model.locale]:t.PdfViewer.Locale["default"],i=o.contextMenu.auto.contentText,r=n("#"+u._id+"_toolbar_zoomSelection").data("ejDropDownList");r&&(f=n("#"+u._id+"_toolbar_zoomSelection_hidden").val(),n("#"+u._id+"_toolbar_zoomSelection_popup li")[0].innerHTML=i,e=r.selectedIndex(),e==0&&isNaN(parseFloat(f))&&(n("#"+u._id+"_toolbar_zoomSelection_hidden").val(i),u._ejDropDownInstance.model.value=i),u._searchBoxLocalization())}u._selectionRange==null||u._displaySearch||(u._selectionNodes.addRange(u._selectionRange),u._selectionRange=null,u._selectionNodes=null)},5e3)},_doAjaxPostscroll:function(i,r,u,f){var e=this;this._ajaxRequestState!=null&&(this._ajaxRequestState.abort(),this._ajaxRequestState=null);this._ajaxInProgress=!0;n.ajax({type:i,url:r,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:u,traditional:!0,success:function(n){var r,i;e._ajaxInProgress=!1;typeof n=="object"?e._drawPdfPage(JSON.stringify(n)):e._drawPdfPage(n);e._scrollTriggered=!1;e._searchText&&e._isRequestFired&&(r=typeof n=="object"?JSON.stringify(n):n,jsondata=typeof n=="object"?e._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(JSON.stringify(n)):JSON.parse(JSON.stringify(n).d):e._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(n):JSON.parse(n.d),e._pageContents[parseInt(jsondata.currentpage)]=r,e._pageText[parseInt(jsondata.currentpage)]=jsondata.pageContents,e._searchText&&e._isRequestFired&&e._initSearch(e._searchPageIndex));f&&e.model.allowClientBuffering&&(i=typeof n=="object"?JSON.parse(JSON.stringify(n)):JSON.parse(n),e._pagesGot.push(parseInt(i.currentpage)),parseInt(i.currentpage)<=e._totalPages&&(e._targetPage=i.currentpage+1,e._isTargetPage=!0))},error:function(n){n.readyState!=0&&e._raiseClientEvent("ajaxRequestFailure",n.responseText)}})},_drawPdfPage:function(r){var ai=r,f,yt,y,u,a,nt,st,s,tt,ht,v,h,ut,pt,fi,ft,d,e,et,ii,vt,c,o;if(r=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(r):JSON.parse(r.d),this._renderedCanvasList.push(parseInt(r.currentpage)),f=parseInt(r.currentpage),this._isWindowResizing||this._showPageLoadingIndicator(f,!0),yt=r.imagestream,y=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage)),y&&this.model){if(u=y.getContext("2d"),a=this._scalingTextContent(u),this._pageSize[f-1].PageRotation==90||this._pageSize[f-1].PageRotation==270?(y.width=this._zoomVal*this._pageSize[f-1].PageWidth,y.height=this._zoomVal*this._pageSize[f-1].PageHeight,y.style.height=this._zoomVal*this._pageSize[f-1].PageHeight+"px",y.style.width=this._zoomVal*this._pageSize[f-1].PageWidth+"px"):(y.width=this._zoomVal*this._pageSize[f-1].PageWidth*a,y.height=this._zoomVal*this._pageSize[f-1].PageHeight*a,y.style.height=this._zoomVal*this._pageSize[f-1].PageHeight+"px",y.style.width=this._zoomVal*this._pageSize[f-1].PageWidth+"px"),this._pageContents[parseInt(r.currentpage)]=ai,this._pageText[parseInt(r.currentpage)]=r.pageContents,this._imageObj=[],n("#"+this._id+"selectioncanvas_"+f).hasClass("text_container")?this._resizeSelection(r,f,u):(this._textSelection(r,f,u),this._textMarkupAnnotationList[parseInt(r.currentpage)]=r.textMarkupAnnotation,this._textMarkupAnnotationList[parseInt(r.currentpage)]&&(this._totalAnnotations[f]=r.textMarkupAnnotation.slice())),n("#"+this._id+"selectioncanvas_"+f).hasClass("input_container")?this._generateFormFields(r,f):this._createFormFields(r,f),navigator.userAgent.indexOf("Firefox")!=-1)for(nt=yt.textelements,st=0;st<nt.length;st++)if(s=nt[st],tt=s.textureBrushs,tt){var vi=s.texturFields[0].Image,rt="data:image/png;base64,"+vi,ri=new Image;ri.src=rt;this._imageSrcCollection.push(ri.src)}for(this._isTextSearch&&(o=this,setTimeout(function(){o._isPageScrollHighlight=!0;o._isPageScrolledForSearch=!0;o._highlightOtherOccurrences()},100)),ht=n("#"+this._id+"selectioncanvas_"+f).children(),d=0;d<ht.length;d++)ht[d].hasAttribute("href")&&n(ht[d]).remove();var b=r.linkannotation,ui=r.annotpagenum,ct=this;if(this.model.enableHyperlink)for(v=0;v<b.length;v++){if(h=document.createElement("a"),h.id="linkdiv_"+v,ut=b[v].AnnotRectangle,h.style.background="transparent",h.style.position="absolute",h.style.left=this._convertPointToPixel(ut.Left*this._zoomVal)+"px",h.style.top=this._convertPointToPixel(ut.Top*this._zoomVal)+"px",h.style.width=this._convertPointToPixel(ut.Width*this._zoomVal)+"px",h.style.height=this._convertPointToPixel(ut.Height*this._zoomVal)+"px",h.style.color="transparent",b[v].URI.indexOf("mailto:")!=-1?(pt=b[v].URI.substring(b[v].URI.indexOf("mailto:"),b[v].URI.length),h.title=pt,h.setAttribute("href",pt)):(h.title=b[v].URI,h.setAttribute("href",b[v].URI)),this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.Default?(h.target="_self",h.onclick=function(){var n={hyperlink:this.href};ct._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewTab?(h.target="_blank",h.onclick=function(){var n={hyperlink:this.href};ct._raiseClientEvent("hyperlinkClick",n)}):this.model.hyperlinkOpenState==t.PdfViewer.LinkTarget.NewWindow&&(h.onclick=function(){var n={hyperlink:this.href};return ct._raiseClientEvent("hyperlinkClick",n),window.open(this.href,"_blank","scrollbars=yes,resizable=yes"),!1}),ui[v]!=i){var yi=this._pageSize[f-1].PageHeight,pi=this._convertPointToPixel(b[v].AnnotLocation),wi=yi-pi,bi=parseFloat(this._pageLocation[ui[v]]*this._zoomVal)+parseFloat(wi*this._zoomVal);h.name=bi;h.onclick=function(){var n=document.getElementById(ct._id+"_viewerContainer");return n.scrollTop=this.name,!1}}fi=document.getElementById(this._id+"selectioncanvas_"+f);fi.appendChild(h)}this._textMarkupAnnotationList[f]&&this._renderTextMarkupAnnotation(this._textMarkupAnnotationList[f],f);var p=parseInt(r.currentpage),wt=[],ei=[],ki=[],oi=[],si=[],di,k=navigator.userAgent,g,hi=0,bt=[],nt=yt.textelements;for(ft=0;ft<nt.length;ft++){var s=nt[ft],kt=s.color,l=s.matrix;l!=null&&(l=l.Elements);var dt=s.brush,w=s.pathValue,gi=s.iscliping,ci=s.restorecanvas,rt=s.imagedata,it=s.fillrule,nr=s.isFillandStroke,tr=s.fillcolor,gt=s.strokecolor,ni=s.linewidth,ti=s.linecap,lt=s.linearGradientBrush,tt=s.textureBrushs,at=s.charID,rr=s.rectvalue,li=s.alpha;if(w!=null?(w=w.split(";"),at&&(bt[at]=w)):w==null&&at&&(w=bt[at]),ci==!1&&u.save(),w!=i&&u.setTransform(l[0]*this._zoomVal*a,l[1]*this._zoomVal*a,l[2]*this._zoomVal*a,l[3]*this._zoomVal*a,l[4]*this._zoomVal*a,l[5]*this._zoomVal*a),w!=null){for(u.beginPath(),d=0;d<w.length;d++)e=w[d],et=e[0],et=="M"?(e=e.substring(1,e.length),e=e.split(" "),u.moveTo(e[0],e[1])):et=="L"?(e=e.substring(1,e.length),e=e.split(" "),u.lineTo(e[0],e[1])):et=="C"?(e=e.substring(1,e.length),e=e.split(" "),u.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])):et=="Z"&&u.closePath();gi==!0?(it=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.clip(it)),u.clip()):nr==i?dt=="Fill"?(lt!=i?u.fillStyle=this._getGradientBrush(lt,u):tt!=i?u.fillStyle=this._createTextureBrush(tt,u,s):(li!=i&&(u.globalAlpha=li),u.fillStyle=kt),it=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(it)),u.fill()):dt=="FillandStroke"?(u.fillStyle=kt,u.fill(),u.strokeStyle=gt,u.stroke()):dt=="Stroke"?(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=kt,u.lineWidth=ni,u.lineCap=ti,u.stroke()):(u.strokeStyle=gt,u.lineWidth=ni,u.lineCap=ti,u.stroke(),u.fillStyle=lt!=i?this._getGradientBrush(lt,u):tt!=i?this._createTextureBrush(tt,u,s):tr,it=="evenodd"&&(u.msFillRule="evenodd",u.mozFillRule="evenodd",u.fill(it)),u.fill())}if(ci&&u.restore(),rt!=i)if((g=k.indexOf("Firefox"))!=-1||(g=k.indexOf("Chrome"))!=-1||(g=k.indexOf("Safari"))!=-1||(g=k.indexOf("AppleWebKit"))!=-1){wt.push(rt);ei.push(l);si.push(nt);oi.push(ft);di=this._zoomVal;this._isContainImage=!0;break}else ii=new Image,ii.src=rt,u.setTransform(l[0]*this._zoomVal*a,l[1]*this._zoomVal*a,l[2]*this._zoomVal*a,l[3]*this._zoomVal*a,l[4]*this._zoomVal*a,l[5]*this._zoomVal*a),u.drawImage(ii,0,0,1,1)}if((g=k.indexOf("Firefox"))!=-1||(g=k.indexOf("Chrome"))!=-1||(g=k.indexOf("Safari"))!=-1||(g=k.indexOf("AppleWebKit"))!=-1)for(vt=0;vt<wt.length;vt++)this._imageRendering(nt,ki,wt,ei,u,vt,si,oi,bt,y,p,hi),hi++;if(c=y,o=this,this._pageSize[p-1].PageRotation!=0&&!(rt!=i&&k.indexOf("Firefox")!=-1)){c=document.getElementById(this._id+"pagecanvas_"+parseInt(r.currentpage));var ir=c.toDataURL(),u=c.getContext("2d"),ot=new Image;ot.onload=function(){u.clearRect(0,0,c.width,c.height);o._pageSize[p-1].PageRotation==90||o._pageSize[p-1].PageRotation==270?(c.width=o._zoomVal*o._pageSize[p-1].PageHeight,c.height=o._zoomVal*o._pageSize[p-1].PageWidth,c.style.height=o._zoomVal*o._pageSize[p-1].PageWidth+"px",c.style.width=o._zoomVal*o._pageSize[p-1].PageHeight+"px"):(c.width=o._zoomVal*o._pageSize[p-1].PageWidth,c.height=o._zoomVal*o._pageSize[p-1].PageHeight,c.style.width=o._zoomVal*o._pageSize[p-1].PageWidth+"px",c.style.height=o._zoomVal*o._pageSize[p-1].PageHeight+"px");u.save();u.translate(c.width/2,c.height/2);u.rotate(o._pageSize[p-1].PageRotation/2*Math.PI/2);u.drawImage(ot,-ot.width/2,-ot.height/2);u.restore()};ot.src=ir}return this._showPageLoadingIndicator(f,!1),this._changingImageCanvasPosition(f),this._showSignature(),c}},_hidingSignature:function(){n(".e-pdfviewer-imagecanvasDraw").hide();var t=document.getElementById(this._id+"e-pdfviewer-selector"),i=document.getElementsByClassName("e-pdfviewer-buttons");n(t).remove();n(i).remove()},_showSignature:function(){n(".e-pdfviewer-imagecanvasDraw").show();var t=document.getElementById(this._id+"e-pdfviewer-selector"),i=document.getElementsByClassName("e-pdfviewer-buttons");n(t).remove();n(i).remove()},_changingImageCanvasPosition:function(){var t=n(".e-pdfviewer-imagecanvasDraw");this._calculatingPositions(t);this._previousZoomValue=this._zoomVal},_calculatingPositions:function(t){for(var f,i=0;i<t.length;i++){var e=parseFloat(n(t[i]).css("left"))/this._previousZoomValue*this._zoomVal,o=parseFloat(n(t[i]).css("top"))/this._previousZoomValue*this._zoomVal,r=parseFloat(n(t[i]).css("width"))/this._previousZoomValue*this._zoomVal,u=parseFloat(n(t[i]).css("height"))/this._previousZoomValue*this._zoomVal;n(t[i]).css("top",o+"px");n(t[i]).css("left",e+"px");t[i].className!="e-pdfviewer-buttons"&&(n(t[i]).css("width",r+"px"),n(t[i]).css("height",u+"px"));f=this._outputPath[t[i