diff --git a/README.md b/README.md index 3c9dcce3..c6a112a4 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,7 @@ -npm install --registry=https://registry.npm.taobao.org +yarn config set registry http://mvn.uat.loc/repository/npm-group/ +yarn dev +yarn build:prod + +npm config set registry http://mvn.uat.loc/repository/npm-group/ npm run dev -npm run build:prod - - - -npm install -S file-saver -npm install -S xlsx -npm install -D script-loader - - - -npm i -S exceljs file-saver luckyexcel -npm install --save jquery - -npm install monaco-editor -S - -npm install vuedraggable --save -npm i -S vuedraggable -npm install --save moment - -npm install jsmind --save - -npm install --save js-base64 - -npm install require.js --save - -npm install font-awesome - -npm install mxgraph-js --save - -npm install vue-i18n@8 --save - -npm install vue-clipboard2 - -npm install sortablejs --save - -npm install vue-property-decorator --save -npm install lodash --save - -npm install --save js-md5 - -npm install --save codemirror - -npm install --save jsbarcode - -npm install --save qrcodejs2 - -npm install --save vue-print-nb - -npm install --save save-svg-as-png - -npm install --save html2canvas - -npm install --save electron-builder - -export ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/ -yarn install --save electron - -npm install -save vue-okr-tree - -npm install @antv/layout --save - -npm install --save @antv/hierarchy - -npm install vue-chartjs - -npm install uuid --save - -npm i @fingerprintjs/fingerprintjs - -``` - -npm install -save dayjs -npm install --save @antv/x6-vue-shape -npm install @antv/x6 --save -``` - -``` -yarn add vue-cli-plugin-dll -npm install threejs - - npm install mini-css-extract-plugin -D -npm install webpack-bundle-analyzer --save-dev - -npm install @antv/x6 --save -``` - -npm install pdfjs-dist@2.7.570 - -``` -yarn add ./libs/XdPdf -yarn add ./libs/XdVuePdf - -npm i fingerprintjs2 -S - -npm install @antv/x6 --save -npm install --save @antv/g6 -``` +npm run build:prod \ No newline at end of file diff --git a/libs/XdBase/index.js b/libs/XdBase/index.js deleted file mode 100644 index c5dd386e..00000000 --- a/libs/XdBase/index.js +++ /dev/null @@ -1,5 +0,0 @@ -function mylog() { - console.log('mylog: ', ...arguments); -} - -module.exports = {mylog}; diff --git a/libs/XdBase/package.json b/libs/XdBase/package.json deleted file mode 100644 index a1c13df8..00000000 --- a/libs/XdBase/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "xdbase", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC" -} diff --git a/libs/XdPdf/XdPdf.vue b/libs/XdPdf/XdPdf.vue deleted file mode 100644 index 88492f0f..00000000 --- a/libs/XdPdf/XdPdf.vue +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - diff --git a/libs/XdPdf/package.json b/libs/XdPdf/package.json deleted file mode 100644 index 444b17bf..00000000 --- a/libs/XdPdf/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "xd-pdf", - "version": "1.0.0", - "description": "", - "main": "XdPdf.vue", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "vue.js", - "pdf", - "viewer" - ], - "author": "alan", - "license": "MIT", - "repository": { - }, - "bugs": { - }, - "homepage": "", - "dependencies": { - "babel-plugin-syntax-dynamic-import": "^6.18.0", - "loader-utils": "^1.4.0", - "raw-loader": "^4.0.1", - "worker-loader": "^2.0.0", - "pdfjs-dist": "^2.5.207", - "vue-resize-sensor": "^2.0.0" - }, - "peerDependencies": {} -} diff --git a/libs/XdVuePdf/.babelrc b/libs/XdVuePdf/.babelrc deleted file mode 100644 index b0328c4b..00000000 --- a/libs/XdVuePdf/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["syntax-dynamic-import"] -} \ No newline at end of file diff --git a/libs/XdVuePdf/.gitignore b/libs/XdVuePdf/.gitignore deleted file mode 100644 index 8d73b75e..00000000 --- a/libs/XdVuePdf/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -# Misc -tests diff --git a/libs/XdVuePdf/.npmignore b/libs/XdVuePdf/.npmignore deleted file mode 100644 index 8d73b75e..00000000 --- a/libs/XdVuePdf/.npmignore +++ /dev/null @@ -1,40 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -# Misc -tests diff --git a/libs/XdVuePdf/ISSUE_TEMPLATE.md b/libs/XdVuePdf/ISSUE_TEMPLATE.md deleted file mode 100644 index fcf9fe3c..00000000 --- a/libs/XdVuePdf/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,17 +0,0 @@ - - diff --git a/libs/XdVuePdf/LICENSE b/libs/XdVuePdf/LICENSE deleted file mode 100644 index 0c23ba0a..00000000 --- a/libs/XdVuePdf/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Franck Freiburger - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/libs/XdVuePdf/README.md b/libs/XdVuePdf/README.md deleted file mode 100644 index 3cc862d3..00000000 --- a/libs/XdVuePdf/README.md +++ /dev/null @@ -1,296 +0,0 @@ -# vue-pdf -vue.js pdf viewer - -## Install -```bash -npm install --save vue-pdf -``` - -## Example - basic -```vue - - - -``` - - -##### Example - display multiple pages of the same pdf document -```vue - - - -``` - - -##### Example - print all pages -```vue - -``` - - -##### Example - print multiple pages -```vue - -``` - - -##### Example - get text content -```vue - - - -``` - - -##### Example - complete -```vue - - -``` - -## Credits -[ Franck Freiburger](https://www.franck-freiburger.com) diff --git a/libs/XdVuePdf/package.json b/libs/XdVuePdf/package.json deleted file mode 100644 index acd730ac..00000000 --- a/libs/XdVuePdf/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "xd-vue-pdf", - "version": "3.0.0", - "description": "vue.js pdf viewer", - "main": "src/vuePdfNoSss.vue", - "scripts": {}, - "keywords": [ - "vue.js", - "pdf", - "viewer" - ], - "author": "Franck FREIBURGER", - "license": "MIT", - "dependencies": { - "babel-plugin-syntax-dynamic-import": "^6.18.0", - "loader-utils": "^1.4.0", - "raw-loader": "^4.0.1", - "worker-loader": "^2.0.0", - "pdfjs-dist-sign": "^2.5.208", - "vue-resize-sensor": "^2.0.0" - }, - "peerDependencies": {} -} diff --git a/libs/XdVuePdf/src/CMapReaderFactory.js b/libs/XdVuePdf/src/CMapReaderFactory.js deleted file mode 100644 index b597bbd9..00000000 --- a/libs/XdVuePdf/src/CMapReaderFactory.js +++ /dev/null @@ -1,18 +0,0 @@ -import { CMapCompressionType } from 'pdfjs-dist-sign/es5/build/pdf.js' - -// see https://github.com/mozilla/pdf.js/blob/628e70fbb5dea3b9066aa5c34cca70aaafef8db2/src/display/dom_utils.js#L64 - -export default function() { - - this.fetch = function(query) { - - return import('./buffer-loader!pdfjs-dist-sign/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */) - .then(function(bcmap) { - - return { - cMapData: bcmap.default, - compressionType: CMapCompressionType.BINARY, - }; - }); - } -}; diff --git a/libs/XdVuePdf/src/annotationLayer.css b/libs/XdVuePdf/src/annotationLayer.css deleted file mode 100644 index e1922f18..00000000 --- a/libs/XdVuePdf/src/annotationLayer.css +++ /dev/null @@ -1,144 +0,0 @@ -/* see https://github.com/mozilla/pdf.js/blob/55a853b6678cf3d05681ffbb521e5228e607b5d2/test/annotation_layer_test.css */ - -.annotationLayer { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; -} - -.annotationLayer section { - position: absolute; -} - -.annotationLayer .linkAnnotation > a { - position: absolute; - font-size: 1em; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -.annotationLayer .linkAnnotation > a /* -ms-a */ { - background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 repeat; -} - -.annotationLayer .linkAnnotation > a:hover { - opacity: 0.2; - background: #ff0; - box-shadow: 0px 2px 10px #ff0; -} - -.annotationLayer .textAnnotation img { - position: absolute; - cursor: pointer; -} - -.annotationLayer .textWidgetAnnotation input, -.annotationLayer .textWidgetAnnotation textarea, -.annotationLayer .choiceWidgetAnnotation select, -.annotationLayer .buttonWidgetAnnotation.checkBox input, -.annotationLayer .buttonWidgetAnnotation.radioButton input { - background-color: rgba(0, 54, 255, 0.13); - border: 1px solid transparent; - box-sizing: border-box; - font-size: 9px; - height: 100%; - padding: 0 3px; - vertical-align: top; - width: 100%; -} - -.annotationLayer .textWidgetAnnotation textarea { - font: message-box; - font-size: 9px; - resize: none; -} - -.annotationLayer .textWidgetAnnotation input[disabled], -.annotationLayer .textWidgetAnnotation textarea[disabled], -.annotationLayer .choiceWidgetAnnotation select[disabled], -.annotationLayer .buttonWidgetAnnotation.checkBox input[disabled], -.annotationLayer .buttonWidgetAnnotation.radioButton input[disabled] { - background: none; - border: 1px solid transparent; - cursor: not-allowed; -} - -.annotationLayer .textWidgetAnnotation input:hover, -.annotationLayer .textWidgetAnnotation textarea:hover, -.annotationLayer .choiceWidgetAnnotation select:hover, -.annotationLayer .buttonWidgetAnnotation.checkBox input:hover, -.annotationLayer .buttonWidgetAnnotation.radioButton input:hover { - border: 1px solid #000; -} - -.annotationLayer .textWidgetAnnotation input:focus, -.annotationLayer .textWidgetAnnotation textarea:focus, -.annotationLayer .choiceWidgetAnnotation select:focus { - background: none; - border: 1px solid transparent; -} - -.annotationLayer .textWidgetAnnotation input.comb { - font-family: monospace; - padding-left: 2px; - padding-right: 0; -} - -.annotationLayer .textWidgetAnnotation input.comb:focus { - /* - * Letter spacing is placed on the right side of each character. Hence, the - * letter spacing of the last character may be placed outside the visible - * area, causing horizontal scrolling. We avoid this by extending the width - * when the element has focus and revert this when it loses focus. - */ - width: 115%; -} - -.annotationLayer .buttonWidgetAnnotation.checkBox input, -.annotationLayer .buttonWidgetAnnotation.radioButton input { - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; -} - -.annotationLayer .popupWrapper { - position: absolute; - width: 20em; -} - -.annotationLayer .popup { - position: absolute; - z-index: 200; - max-width: 20em; - background-color: #FFFF99; - box-shadow: 0px 2px 5px #333; - border-radius: 2px; - padding: 0.6em; - margin-left: 5px; - cursor: pointer; - word-wrap: break-word; -} - -.annotationLayer .popup h1 { - font-size: 1em; - border-bottom: 1px solid #000000; - padding-bottom: 0.2em; -} - -.annotationLayer .popup p { - padding-top: 0.2em; -} - -.annotationLayer .highlightAnnotation, -.annotationLayer .underlineAnnotation, -.annotationLayer .squigglyAnnotation, -.annotationLayer .strikeoutAnnotation, -.annotationLayer .lineAnnotation svg line, -.annotationLayer .fileAttachmentAnnotation { - cursor: pointer; -} diff --git a/libs/XdVuePdf/src/buffer-loader.js b/libs/XdVuePdf/src/buffer-loader.js deleted file mode 100644 index 464c5a35..00000000 --- a/libs/XdVuePdf/src/buffer-loader.js +++ /dev/null @@ -1,16 +0,0 @@ -var loaderUtils = require('loader-utils'); - -module.exports = function(content) { - - var options = loaderUtils.getOptions(this); - - var data; - if ( content instanceof Buffer ) - data = content; - else - data = Buffer.from(content); - - return 'export default Buffer.from("'+data.toString('base64')+'", "base64")'; -} - -module.exports.raw = true; diff --git a/libs/XdVuePdf/src/componentFactory.js b/libs/XdVuePdf/src/componentFactory.js deleted file mode 100644 index 7ea49106..00000000 --- a/libs/XdVuePdf/src/componentFactory.js +++ /dev/null @@ -1,111 +0,0 @@ -import resizeSensor from 'vue-resize-sensor' - -export default function(pdfjsWrapper) { - - var createLoadingTask = pdfjsWrapper.createLoadingTask; - var PDFJSWrapper = pdfjsWrapper.PDFJSWrapper; - - return { - createLoadingTask: createLoadingTask, - render: function(h) { - return h('span', { - attrs: { - style: 'position: relative; display: block' - } - }, [ - h('canvas', { - attrs: { - style: 'display: inline-block; width: 100%; height: 100%; vertical-align: top', - }, - ref:'canvas' - }), - h('span', { - style: 'display: inline-block; width: 100%; height: 100%', - class: 'annotationLayer', - ref:'annotationLayer' - }), - h(resizeSensor, { - props: { - initial: true - }, - on: { - resize: this.resize - }, - }) - ]) - }, - props: { - src: { - type: [String, Object, Uint8Array], - default: '', - }, - page: { - type: Number, - default: 1, - }, - rotate: { - type: Number, - }, - }, - watch: { - src: function() { - - this.pdf.loadDocument(this.src); - }, - page: function() { - - this.pdf.loadPage(this.page, this.rotate); - }, - rotate: function() { - this.pdf.renderPage(this.rotate); - }, - }, - methods: { - resize: function(size) { - - // check if the element is attached to the dom tree || resizeSensor being destroyed - if ( this.$el.parentNode === null || (size.width === 0 && size.height === 0) ) - return; - - // on IE10- canvas height must be set - this.$refs.canvas.style.height = this.$refs.canvas.offsetWidth * (this.$refs.canvas.height / this.$refs.canvas.width) + 'px'; - // update the page when the resolution is too poor - var resolutionScale = this.pdf.getResolutionScale(); - - if ( resolutionScale < 0.85 || resolutionScale > 1.15 ) - this.pdf.renderPage(this.rotate); - - // this.$refs.annotationLayer.style.transform = 'scale('+resolutionScale+')'; - }, - print: function(dpi, pageList) { - - this.pdf.printPage(dpi, pageList); - } - }, - - // doc: mounted hook is not called during server-side rendering. - mounted: function() { - - this.pdf = new PDFJSWrapper(this.$refs.canvas, this.$refs.annotationLayer, this.$emit.bind(this)); - - this.$on('loaded', function() { - - this.pdf.loadPage(this.page, this.rotate); - }); - - this.$on('page-size', function(width, height) { - - this.$refs.canvas.style.height = this.$refs.canvas.offsetWidth * (height / width) + 'px'; - }); - - this.pdf.loadDocument(this.src); - }, - - // doc: destroyed hook is not called during server-side rendering. - destroyed: function() { - - this.pdf.destroy(); - } - } - -} diff --git a/libs/XdVuePdf/src/pdfjsWrapper.js b/libs/XdVuePdf/src/pdfjsWrapper.js deleted file mode 100644 index 3bfbbc62..00000000 --- a/libs/XdVuePdf/src/pdfjsWrapper.js +++ /dev/null @@ -1,386 +0,0 @@ -import { PDFLinkService } from 'pdfjs-dist-sign/es5/web/pdf_viewer'; - -var pendingOperation = Promise.resolve(); - -export default function(PDFJS) { - - function isPDFDocumentLoadingTask(obj) { - - return typeof(obj) === 'object' && obj !== null && obj.__PDFDocumentLoadingTask === true; - // or: return obj.constructor.name === 'PDFDocumentLoadingTask'; - } - - function createLoadingTask(src, options) { - - var source; - if ( typeof(src) === 'string' ) - source = { url: src }; - else if ( src instanceof Uint8Array ) - source = { data: src }; - else if ( typeof(src) === 'object' && src !== null ) - source = Object.assign({}, src); - else - throw new TypeError('invalid src type'); - - // source.verbosity = PDFJS.VerbosityLevel.INFOS; - // source.pdfBug = true; - // source.stopAtErrors = true; - - var loadingTask = PDFJS.getDocument(source); - loadingTask.__PDFDocumentLoadingTask = true; // since PDFDocumentLoadingTask is not public - - if ( options && options.onPassword ) - loadingTask.onPassword = options.onPassword; - - if ( options && options.onProgress ) - loadingTask.onProgress = options.onProgress; - - return loadingTask; - } - - - function PDFJSWrapper(canvasElt, annotationLayerElt, emitEvent) { - - var pdfDoc = null; - var pdfPage = null; - var pdfRender = null; - var canceling = false; - - canvasElt.getContext('2d').save(); - - function clearCanvas() { - - canvasElt.getContext('2d').clearRect(0, 0, canvasElt.width, canvasElt.height); - } - - function clearAnnotations() { - - while ( annotationLayerElt.firstChild ) - annotationLayerElt.removeChild(annotationLayerElt.firstChild); - } - - this.destroy = function() { - - if ( pdfDoc === null ) - return; - - // Aborts all network requests and destroys worker. - pendingOperation = pdfDoc.destroy(); - pdfDoc = null; - } - - this.getResolutionScale = function() { - - return canvasElt.offsetWidth / canvasElt.width; - } - - this.printPage = function(dpi, pageNumberOnly) { - - if ( pdfPage === null ) - return; - - // 1in == 72pt - // 1in == 96px - var PRINT_RESOLUTION = dpi === undefined ? 150 : dpi; - var PRINT_UNITS = PRINT_RESOLUTION / 72.0; - var CSS_UNITS = 96.0 / 72.0; - - var iframeElt = document.createElement('iframe'); - - function removeIframe() { - - iframeElt.parentNode.removeChild(iframeElt); - } - - new Promise(function(resolve, reject) { - - iframeElt.frameBorder = '0'; - iframeElt.scrolling = 'no'; - iframeElt.width = '0px;' - iframeElt.height = '0px;' - iframeElt.style.cssText = 'position: absolute; top: 0; left: 0'; - - iframeElt.onload = function() { - - resolve(this.contentWindow); - } - - window.document.body.appendChild(iframeElt); - }) - .then(function(win) { - - win.document.title = ''; - - return pdfDoc.getPage(1) - .then(function(page) { - - var viewport = page.getViewport({ scale: 1 }); - win.document.head.appendChild(win.document.createElement('style')).textContent = - '@supports ((size:A4) and (size:1pt 1pt)) {' + - '@page { margin: 1pt; size: ' + ((viewport.width * PRINT_UNITS) / CSS_UNITS) + 'pt ' + ((viewport.height * PRINT_UNITS) / CSS_UNITS) + 'pt; }' + - '}' + - - '@media print {' + - 'body { margin: 0 }' + - 'canvas { page-break-before: avoid; page-break-after: always; page-break-inside: avoid }' + - '}'+ - - '@media screen {' + - 'body { margin: 0 }' + - '}'+ - - '' - return win; - }) - }) - .then(function(win) { - - var allPages = []; - - for ( var pageNumber = 1; pageNumber <= pdfDoc.numPages; ++pageNumber ) { - - if ( pageNumberOnly !== undefined && pageNumberOnly.indexOf(pageNumber) === -1 ) - continue; - - allPages.push( - pdfDoc.getPage(pageNumber) - .then(function(page) { - - var viewport = page.getViewport({ scale: 1 }); - - var printCanvasElt = win.document.body.appendChild(win.document.createElement('canvas')); - printCanvasElt.width = (viewport.width * PRINT_UNITS); - printCanvasElt.height = (viewport.height * PRINT_UNITS); - - return page.render({ - canvasContext: printCanvasElt.getContext('2d'), - transform: [ // Additional transform, applied just before viewport transform. - PRINT_UNITS, 0, 0, - PRINT_UNITS, 0, 0 - ], - viewport: viewport, - intent: 'print' - }).promise; - }) - ); - } - - Promise.all(allPages) - .then(function() { - - win.focus(); // Required for IE - if (win.document.queryCommandSupported('print')) { - win.document.execCommand('print', false, null); - } else { - win.print(); - } - removeIframe(); - }) - .catch(function(err) { - - removeIframe(); - emitEvent('error', err); - }) - }) - } - - this.renderPage = function(rotate) { - if ( pdfRender !== null ) { - - if ( canceling ) - return; - canceling = true; - pdfRender.cancel(); - return; - } - - if ( pdfPage === null ) - return; - - var pageRotate = (pdfPage.rotate === undefined ? 0 : pdfPage.rotate) + (rotate === undefined ? 0 : rotate); - - var scale = canvasElt.offsetWidth / pdfPage.getViewport({ scale: 1 }).width * (window.devicePixelRatio || 1); - var viewport = pdfPage.getViewport({ scale: scale, rotation:pageRotate }); - - emitEvent('page-size', viewport.width, viewport.height, scale); - - canvasElt.width = viewport.width; - canvasElt.height = viewport.height; - - pdfRender = pdfPage.render({ - canvasContext: canvasElt.getContext('2d'), - viewport: viewport - }); - - annotationLayerElt.style.visibility = 'hidden'; - clearAnnotations(); - - var viewer = { - scrollPageIntoView: function(params) { - emitEvent('link-clicked', params.pageNumber) - }, - }; - - var linkService = new PDFLinkService(); - linkService.setDocument(pdfDoc); - linkService.setViewer(viewer); - - pendingOperation = pendingOperation.then(function() { - - var getAnnotationsOperation = - pdfPage.getAnnotations({ intent: 'display' }) - .then(function(annotations) { - - PDFJS.AnnotationLayer.render({ - viewport: viewport.clone({ dontFlip: true }), - div: annotationLayerElt, - annotations: annotations, - page: pdfPage, - linkService: linkService, - renderInteractiveForms: false - }); - }); - - var pdfRenderOperation = - pdfRender.promise - .then(function() { - - annotationLayerElt.style.visibility = ''; - canceling = false; - pdfRender = null; - }) - .catch(function(err) { - - pdfRender = null; - if ( err instanceof PDFJS.RenderingCancelledException ) { - - canceling = false; - this.renderPage(rotate); - return; - } - emitEvent('error', err); - }.bind(this)) - - return Promise.all([getAnnotationsOperation, pdfRenderOperation]); - }.bind(this)); - } - - - this.forEachPage = function(pageCallback) { - - var numPages = pdfDoc.numPages; - - (function next(pageNum) { - - pdfDoc.getPage(pageNum) - .then(pageCallback) - .then(function() { - - if ( ++pageNum <= numPages ) - next(pageNum); - }) - })(1); - } - - - this.loadPage = function(pageNumber, rotate) { - - pdfPage = null; - - if ( pdfDoc === null ) - return; - - pendingOperation = pendingOperation.then(function() { - - return pdfDoc.getPage(pageNumber); - }) - .then(function(page) { - - pdfPage = page; - this.renderPage(rotate); - emitEvent('page-loaded', page.pageNumber); - }.bind(this)) - .catch(function(err) { - - clearCanvas(); - clearAnnotations(); - emitEvent('error', err); - }); - } - - this.loadDocument = function(src) { - - pdfDoc = null; - pdfPage = null; - - emitEvent('num-pages', undefined); - - if ( !src ) { - - canvasElt.removeAttribute('width'); - canvasElt.removeAttribute('height'); - clearAnnotations(); - return; - } - - // wait for pending operation ends - pendingOperation = pendingOperation.then(function() { - - var loadingTask; - if ( isPDFDocumentLoadingTask(src) ) { - - if ( src.destroyed ) { - - emitEvent('error', new Error('loadingTask has been destroyed')); - return - } - - loadingTask = src; - } else { - - loadingTask = createLoadingTask(src, { - onPassword: function(updatePassword, reason) { - - var reasonStr; - switch (reason) { - case PDFJS.PasswordResponses.NEED_PASSWORD: - reasonStr = 'NEED_PASSWORD'; - break; - case PDFJS.PasswordResponses.INCORRECT_PASSWORD: - reasonStr = 'INCORRECT_PASSWORD'; - break; - } - emitEvent('password', updatePassword, reasonStr); - }, - onProgress: function(status) { - - var ratio = status.loaded / status.total; - emitEvent('progress', Math.min(ratio, 1)); - } - }); - } - - return loadingTask.promise; - }) - .then(function(pdf) { - - pdfDoc = pdf; - emitEvent('num-pages', pdf.numPages); - emitEvent('loaded'); - }) - .catch(function(err) { - - clearCanvas(); - clearAnnotations(); - emitEvent('error', err); - }) - } - - annotationLayerElt.style.transformOrigin = '0 0'; - } - - return { - createLoadingTask: createLoadingTask, - PDFJSWrapper: PDFJSWrapper, - } -} diff --git a/libs/XdVuePdf/src/vuePdfNoSss.vue b/libs/XdVuePdf/src/vuePdfNoSss.vue deleted file mode 100644 index 0d3869a8..00000000 --- a/libs/XdVuePdf/src/vuePdfNoSss.vue +++ /dev/null @@ -1,24 +0,0 @@ - - \ No newline at end of file diff --git a/libs/XdVuePdf/src/vuePdfNoSssNoWorker.vue b/libs/XdVuePdf/src/vuePdfNoSssNoWorker.vue deleted file mode 100644 index 72d3bd82..00000000 --- a/libs/XdVuePdf/src/vuePdfNoSssNoWorker.vue +++ /dev/null @@ -1,17 +0,0 @@ - - \ No newline at end of file diff --git a/libs/XdVuePdf/src/vuePdfSss.vue b/libs/XdVuePdf/src/vuePdfSss.vue deleted file mode 100644 index 68a812c4..00000000 --- a/libs/XdVuePdf/src/vuePdfSss.vue +++ /dev/null @@ -1,23 +0,0 @@ - - \ No newline at end of file diff --git a/libs/readme b/libs/readme deleted file mode 100644 index 2e39265e..00000000 --- a/libs/readme +++ /dev/null @@ -1,21 +0,0 @@ - -npm adduser --registry=http://npm.uat.loc/ - -npm login --registry http://43.139.27.159:4873/ -npm logout --registry http://43.139.27.159:4873/ - -npm publish --registry=http://npm.uat.loc/ -npm install XdVuePdf --registry=http://npm.uat.loc/ -npm update XdVuePdf --registry=http://127.0.0.1:9001 - -npm config set registry http://npm.uat.loc/ - - - -npm config set registry https://registry.npmmirror.com - - - -npm config set registry https://registry.npmmirror.com -npm config set registry https://registry.npmmirror.com -npm install --registry=https://registry.npm.taobao.org diff --git a/package.json b/package.json index 9ed3654f..5f1d2466 100644 --- a/package.json +++ b/package.json @@ -113,8 +113,8 @@ "vuedraggable": "^2.24.3", "vuex": "3.6.0", "watermark-dom": "2.3.0", - "xd-pdf": "./libs/XdPdf", - "xd-vue-pdf": "./libs/XdVuePdf", + "xd-pdf": "1.0.0", + "xd-vue-pdf": "3.0.0", "xlsx": "^0.17.5" }, "devDependencies": {