Files
yusheng-h5/uni_modules/simple-pdf-viewer/bundles/simple-pdf-viewer.umd.min.js

3 lines
24 KiB
JavaScript
Raw Normal View History

2025-12-31 14:44:40 +08:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common/http"],e):e(t["simple-pdf-viewer"]={},t.ng.core,t.ng.common.http)}(this,function(t,e,n){"use strict";var o={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};o[o.FOUND]="FOUND",o[o.NOT_FOUND]="NOT_FOUND",o[o.WRAPPED]="WRAPPED",o[o.PENDING]="PENDING";var i=function(){return function(t,e){this.key=t,this.value=e}}(),r=function(){return function(t,e,n){this.title=t,this.dest=e,this.items=n}}(),a=function(){return function(t,e){this.loaded=t,this.total=e}}(),s=function(){return function(t,e,n){void 0===t&&(t=!1),void 0===e&&(e=!0),void 0===n&&(n=!0),this.caseSensitive=t,this.highlightAll=e,this.phraseSearch=n}}();s.DEFAULT_OPTIONS=new s;var A=function(){function t(t,e,n,o,i){void 0===t&&(t=1),void 0===e&&(e=1),void 0===n&&(n=0),void 0===o&&(o=0),void 0===i&&(i=0),this.page=t,this.zoom=e,this.rotation=n,this.x=o,this.y=i}return t.prototype.toDestination=function(){return{pageNumber:this.page,destArray:[null,{name:"XYZ"},this.x,this.y,this.zoom]}},t.prototype.toQueryString=function(){return t.PARAMETER_SEPARATOR+(t.PARAMETER_PAGE+"=")+this.page+t.PARAMETER_SEPARATOR+t.PARAMETER_ZOOM+"="+this.zoom+t.PARAMETER_SEPARATOR+t.PARAMETER_ROTATION+"="+this.rotation+t.PARAMETER_SEPARATOR+t.PARAMETER_X+"="+this.x+t.PARAMETER_SEPARATOR+t.PARAMETER_Y+"="+this.y},t.buildSimplePDFBookmark=function(e){if(e&&"string"==typeof e&&e.trim().length>0){var n=e.split(t.PARAMETER_SEPARATOR);if(n.length>0){var o=new t;return n.forEach(function(e){var n=e.split("="),i=n[0];if(2===n.length&&o.hasOwnProperty(i)){var r=0;r=i===t.PARAMETER_ZOOM?parseFloat(""+n[1]):parseInt(""+n[1],10),r=Number.isNaN(r)?0:r,o[i]=r}}),o}}return t.EMPTY_BOOKMARK},t}();A.EMPTY_BOOKMARK=new A(1,.75,0,0,0),A.PARAMETER_SEPARATOR="#",A.PARAMETER_PAGE="page",A.PARAMETER_ZOOM="zoom",A.PARAMETER_ROTATION="rotation",A.PARAMETER_X="x",A.PARAMETER_Y="y";var h={FULL:0,WIDTH:1,HEIGHT:2};h[h.FULL]="FULL",h[h.WIDTH]="WIDTH",h[h.HEIGHT]="HEIGHT","undefined"!=typeof window&&(window["pdfjs-dist/build/pdf"]=require("pdfjs-dist/build/pdf"),require("pdfjs-dist/web/compatibility"),require("pdfjs-dist/web/pdf_viewer"),PDFJS.verbosity=PDFJS.VERBOSITY_LEVELS.errors);var p=function(){function t(t,n){this.element=t,this.http=n,this.removePageBorders=!1,this.disableTextLayer=!1,this.onLoadComplete=new e.EventEmitter,this.onError=new e.EventEmitter,this.onProgress=new e.EventEmitter,this.onSearchStateChange=new e.EventEmitter,this.startAt=A.EMPTY_BOOKMARK,this.loaded=!1,this.currentPage=1,this.numberOfPages=1,this.outline=[],this.zoom=1,this.rotation=0,this.searching=!1,this.lastSearchText="",this.searchPrevious=!1,this.searchOptions=s.DEFAULT_OPTIONS}return t.prototype.ngOnInit=function(){if("undefined"!=typeof window){if("string"!=typeof PDFJS.workerSrc){var t="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/"+PDFJS.version+"/pdf.worker.min.js";PDFJS.workerSrc=t}this.initPDFJS(),this.openDocument(this.src)}},t.prototype.ngOnDestroy=function(){this.pdf&&this.pdf.destroy()},t.prototype.openDocument=function(t,e){void 0===e&&(e=A.EMPTY_BOOKMARK),this.resetParameters(),this.startAt=e,this.setAndParseSrc(t),this.loadFile()},t.prototype.openFile=function(t,e){var n=this;void 0===e&&(e=A.EMPTY_BOOKMARK);try{var o=new FileReader;o.onload=function(){n.openDocument(new Uint8Array(o.result),e)},o.onerror=function(t){n.onError.emit(t),n.loaded=!1},o.readAsArrayBuffer(t)}catch(i){this.onError.emit(i),this.loaded=!1}},t.prototype.openUrl=function(t,e){var n=this;void 0===e&&(e=A.EMPTY_BOOKMARK),this.http.get(t,{responseType:"arraybuffer"}).subscribe(function(t){n.openDocument(new Uint8Array(t),e)},function(t){n.onError.emit(t),n.loaded=!1})},t.prototype.isDocumentLoaded=function(){return this.loaded},t.prototype.initPDFJS=function(){var t=this.getContainer();PDFJS.disableTextLayer=this.disableTextLayer,this.pdfLinkService=new PDFJS.PDFLinkService,this.pdfViewer=new PDFJS.PDFSinglePageViewer({container:t,re
//# sourceMappingURL=simple-pdf-viewer.umd.min.js.map