md
This commit is contained in:
parent
a7da890cb2
commit
1ac4705502
102
README.md
102
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 dev
|
||||||
npm run build:prod
|
npm run build:prod
|
||||||
|
|
||||||
<!-- xlsx -->
|
|
||||||
|
|
||||||
npm install -S file-saver
|
|
||||||
npm install -S xlsx
|
|
||||||
npm install -D script-loader
|
|
||||||
|
|
||||||
<!-- luckyexcel -->
|
|
||||||
|
|
||||||
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
|
|
||||||
```
|
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
function mylog() {
|
|
||||||
console.log('mylog: ', ...arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {mylog};
|
|
||||||
@ -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"
|
|
||||||
}
|
|
||||||
@ -1,237 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<!-- <button @click="scalBig">放大</button>
|
|
||||||
<button @click="scalSmall">缩小</button>
|
|
||||||
<p>页码:{{ `${pageNo}/${totals.length}` }}</p>
|
|
||||||
<div class="drag-box" id="dragBox" @scroll="scrollfun($event)">
|
|
||||||
<el-scrollbar>
|
|
||||||
<div class="wrapper" id="pdf-container">
|
|
||||||
<div v-for="item in totals" :id="`page-${item}`" :key="item" class="pdf-box">
|
|
||||||
<canvas :id="'canvas-pdf-' + item" class="canvas-pdf"></canvas>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-scrollbar>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div ref="pdfContainer">
|
|
||||||
<div v-loading="loading"></div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<canvas ref="canvas" v-for="(page, index) in totalPages" :key="index" ></canvas>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// const PDFJS = require('pdfjs-dist')
|
|
||||||
// PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.min')
|
|
||||||
// import { TextLayerBuilder } from 'pdfjs-dist/web/pdf_viewer'
|
|
||||||
// import 'pdfjs-dist/web/pdf_viewer.css'
|
|
||||||
|
|
||||||
|
|
||||||
// const PDFJS = require('@/static/pdfjs/pdfjs-4.3.136/build/pdf.mjs')
|
|
||||||
// PDFJS.GlobalWorkerOptions.workerSrc = require('@/static/pdfjs/pdfjs-4.3.136/build/pdf.worker.mjs')
|
|
||||||
|
|
||||||
// import * as PDFJS from '../pdfjs-4.3.136/build/pdf.mjs';
|
|
||||||
// import pdfjsWorker from '../pdfjs-4.3.136/build/pdf.worker.mjs';
|
|
||||||
const PDFJS = require('@/utils/pdfjs/pdfjs-4.3.136/build/pdf.mjs')
|
|
||||||
PDFJS.GlobalWorkerOptions.workerSrc = require('@/utils/pdfjs/pdfjs-4.3.136/build/pdf.worker.mjs')
|
|
||||||
import axios from 'axios';
|
|
||||||
// PDFJS.GlobalWorkerOptions.workerSrc=pdfjsWorker
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'showPdf',
|
|
||||||
props: {
|
|
||||||
pdfUrl:{
|
|
||||||
type: String,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading:true,
|
|
||||||
scale: 1.4,
|
|
||||||
totals: [],
|
|
||||||
pageNo: 1,
|
|
||||||
viewHeight: 0,
|
|
||||||
|
|
||||||
|
|
||||||
totalPages: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// this.renderPdf(this.scale)
|
|
||||||
this.initData();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
pdfUrl(val){
|
|
||||||
if(pdfUrl){
|
|
||||||
this.showPdf();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// scale(val) {
|
|
||||||
// this.totals = []
|
|
||||||
// this.renderPdf(val)
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// async previewPDF(pdfUrl) {
|
|
||||||
// const container = this.$refs.pdfContainer;
|
|
||||||
// const loadingTask = PDFJS.getDocument(pdfUrl);
|
|
||||||
// const pdf = await loadingTask.promise;
|
|
||||||
// const numPages = pdf.numPages;
|
|
||||||
// for (let i = 1; i <= numPages; i++) {
|
|
||||||
// const page = await pdf.getPage(i);
|
|
||||||
// const canvas = document.createElement('canvas');
|
|
||||||
// container.appendChild(canvas);
|
|
||||||
// const context = canvas.getContext('2d');
|
|
||||||
// const viewport = page.getViewport({ scale: 1 });
|
|
||||||
// canvas.width = viewport.width;
|
|
||||||
// canvas.height = viewport.height;
|
|
||||||
// const renderContext = {
|
|
||||||
// canvasContext: context,
|
|
||||||
// viewport: viewport
|
|
||||||
// };
|
|
||||||
// await page.render(renderContext).promise;
|
|
||||||
// this.loading = false
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
async showPdf() {
|
|
||||||
PDFJS.getDocument(this.pdfUrl).promise.then(pdf => {
|
|
||||||
this.totalPages = pdf._pdfInfo.numPages
|
|
||||||
for (let pageIndex = 1; pageIndex <= this.totalPages; pageIndex++) {
|
|
||||||
pdf.getPage(pageIndex).then(page => {
|
|
||||||
this.renderPDFPage(page, pageIndex)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
renderPDFPage(page, pageIndex) {
|
|
||||||
const canvas = this.$refs.canvas[pageIndex - 1]
|
|
||||||
const dpiRatio = window.devicePixelRatio || 1
|
|
||||||
const viewportOptions = { scale: 1, useCurrentScale: false, dontFlip: false, pixelRatio: dpiRatio, isMobile: true }
|
|
||||||
const viewport = page.getViewport(viewportOptions)
|
|
||||||
canvas.height = viewport.height
|
|
||||||
canvas.width = viewport.width
|
|
||||||
|
|
||||||
const renderContext = {
|
|
||||||
canvasContext: canvas.getContext('2d'),
|
|
||||||
viewport: viewport
|
|
||||||
}
|
|
||||||
page.render(renderContext)
|
|
||||||
},
|
|
||||||
|
|
||||||
async downloadAndConvertToUint8Array(pdfUrl) {
|
|
||||||
// 使用 axios 发送 GET 请求获取 PDF 文件数据
|
|
||||||
const response = await axios({
|
|
||||||
url: pdfUrl,
|
|
||||||
method: 'GET',
|
|
||||||
responseType: 'arraybuffer', // 设置响应类型为 arraybuffer
|
|
||||||
});
|
|
||||||
|
|
||||||
// 将 arraybuffer 转换为 Uint8Array
|
|
||||||
const uint8Array = new Uint8Array(response.data);
|
|
||||||
|
|
||||||
return uint8Array;
|
|
||||||
},
|
|
||||||
renderPdf(scale) {
|
|
||||||
|
|
||||||
this.downloadAndConvertToUint8Array(this.pdfUrl)
|
|
||||||
.then((uint8Array) => {
|
|
||||||
console.log(uint8Array);
|
|
||||||
// 现在你可以用这个 Uint8Array 对象进行进一步处理,例如传递给PDF.js库渲染PDF
|
|
||||||
// 当 PDF 地址为跨域时,pdf 应该已流的形式传输,否则会出现pdf损坏无法展示
|
|
||||||
PDFJS.getDocument(uint8Array).then(pdf => {
|
|
||||||
// 得到PDF的总的页数
|
|
||||||
let totalPage = pdf.numPages
|
|
||||||
let idName = 'canvas-pdf-'
|
|
||||||
// 根据总的页数创建相同数量的canvas
|
|
||||||
this.createCanvas(totalPage, idName)
|
|
||||||
for (let i = 1; i <= totalPage; i++) {
|
|
||||||
pdf.getPage(i).then((page) => {
|
|
||||||
let pageDiv = document.getElementById(`page-${i}`)
|
|
||||||
let viewport = page.getViewport(scale)
|
|
||||||
let canvas = document.getElementById(idName + i)
|
|
||||||
let context = canvas.getContext('2d')
|
|
||||||
canvas.height = viewport.height
|
|
||||||
canvas.width = viewport.width
|
|
||||||
this.viewHeight = viewport.height
|
|
||||||
let renderContext = {
|
|
||||||
canvasContext: context,
|
|
||||||
viewport
|
|
||||||
}
|
|
||||||
// 如果你只是展示pdf而不需要复制pdf内容功能,则可以这样写render
|
|
||||||
// page.render(renderContext) 如果你需要复制则像下面那样写利用text-layer
|
|
||||||
page.render(renderContext).then(() => {
|
|
||||||
return page.getTextContent()
|
|
||||||
}).then((textContent) => {
|
|
||||||
// 创建文本图层div
|
|
||||||
const textLayerDiv = document.createElement('div')
|
|
||||||
textLayerDiv.setAttribute('class', 'textLayer')
|
|
||||||
// 将文本图层div添加至每页pdf的div中
|
|
||||||
pageDiv.appendChild(textLayerDiv)
|
|
||||||
// 创建新的TextLayerBuilder实例
|
|
||||||
let textLayer = new TextLayerBuilder({
|
|
||||||
textLayerDiv: textLayerDiv,
|
|
||||||
pageIndex: page.pageIndex,
|
|
||||||
viewport: viewport
|
|
||||||
})
|
|
||||||
textLayer.setTextContent(textContent)
|
|
||||||
textLayer.render()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error downloading or converting the PDF:', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
createCanvas(totalPages) {
|
|
||||||
for (let i = 1; i <= totalPages; i++) {
|
|
||||||
this.totals.push(i)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 分页
|
|
||||||
scrollfun(e) {
|
|
||||||
let scrollTop = e.target.scrollTop
|
|
||||||
if (scrollTop === 0) {
|
|
||||||
this.pageNo = 1
|
|
||||||
} else {
|
|
||||||
this.pageNo = Math.ceil(scrollTop / this.viewHeight)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 放大
|
|
||||||
scalBig() {
|
|
||||||
this.scale = this.scale + 0.1
|
|
||||||
},
|
|
||||||
// 缩小
|
|
||||||
scalSmall() {
|
|
||||||
if (this.scale > 1.2) {
|
|
||||||
this.scale = this.scale - 0.1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
canvas {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drag-box {
|
|
||||||
height: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pdf-box {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-scrollbar__wrap {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -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": {}
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["syntax-dynamic-import"]
|
|
||||||
}
|
|
||||||
40
libs/XdVuePdf/.gitignore
vendored
40
libs/XdVuePdf/.gitignore
vendored
@ -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
|
|
||||||
@ -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
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<!--
|
|
||||||
IMPORTANT
|
|
||||||
=========
|
|
||||||
- use english language.
|
|
||||||
- check if the problem has not already been reported or fixed (https://github.com/FranckFreiburger/vue-pdf/issues?q=is%3Aissue).
|
|
||||||
- only report one issue at a time (if you encounter two problems, fill two issues).
|
|
||||||
- provide a complete description of your problem, add screenshots if necessary.
|
|
||||||
- if the issue is related to the pdf content display, try to open with http://mozilla.github.io/pdf.js/web/viewer.html?file=
|
|
||||||
- provide:
|
|
||||||
- vue-pdf version
|
|
||||||
- vue.js version
|
|
||||||
- webpack version
|
|
||||||
- browser version
|
|
||||||
- OS version
|
|
||||||
- if possible, provide a minimal testcase to reproduce your problem.
|
|
||||||
-->
|
|
||||||
|
|
||||||
@ -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.
|
|
||||||
@ -1,296 +0,0 @@
|
|||||||
# vue-pdf
|
|
||||||
vue.js pdf viewer
|
|
||||||
|
|
||||||
## Install
|
|
||||||
```bash
|
|
||||||
npm install --save vue-pdf
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example - basic
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<pdf src="./static/relativity.pdf"></pdf>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import pdf from 'vue-pdf'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
pdf
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Demo
|
|
||||||
|
|
||||||
[vue-pdf demo on jsfiddle](https://jsfiddle.net/fossfiddler/5k4ptmqg/145/)
|
|
||||||
|
|
||||||
_TBD: fix the demo_
|
|
||||||
|
|
||||||
## Browser support
|
|
||||||
Same browser support as [Vue.js 2](https://github.com/vuejs/vue/blob/dev/README.md)
|
|
||||||
|
|
||||||
## Note
|
|
||||||
since v2.x, the script is exported as esm.
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### Props
|
|
||||||
|
|
||||||
#### :src <sup>String / Object - default: ''<sup>
|
|
||||||
The url of the pdf file. `src` may also be a `string|TypedArray|DocumentInitParameters|PDFDataRangeTransport` for more details, see [`PDFJS.getDocument()`](https://github.com/mozilla/pdf.js/blob/8ff1fbe7f819513e7d0023df961e3d223b35aefa/src/display/api.js#L117).
|
|
||||||
|
|
||||||
#### :page <sup>Number - default: 1<sup>
|
|
||||||
The page number to display.
|
|
||||||
|
|
||||||
#### :rotate <sup>Number - default: 0<sup>
|
|
||||||
The page rotation in degrees, only multiple of 90 are valid.
|
|
||||||
|
|
||||||
### Events
|
|
||||||
|
|
||||||
#### @password <sup>(updatePassword, reason)<sup>
|
|
||||||
* `updatePassword`: The function to call with the pdf password.
|
|
||||||
* `reason`: the reason why this function is called `'NEED_PASSWORD'` or `'INCORRECT_PASSWORD'`
|
|
||||||
|
|
||||||
#### @progress <sup>Number<sup>
|
|
||||||
Document loading progress. Range [0, 1].
|
|
||||||
|
|
||||||
#### @loaded
|
|
||||||
Triggered when the document is loaded.
|
|
||||||
|
|
||||||
#### @page-loaded <sup>Number<sup>
|
|
||||||
Triggered when a page is loaded.
|
|
||||||
|
|
||||||
#### @num-pages <sup>Number<sup>
|
|
||||||
The total number of pages of the pdf.
|
|
||||||
|
|
||||||
#### @error <sup>Object<sup>
|
|
||||||
Triggered when an error occurred.
|
|
||||||
|
|
||||||
#### @link-clicked <sup>Number<sup>
|
|
||||||
Triggered when an internal link is clicked
|
|
||||||
|
|
||||||
|
|
||||||
### Public methods
|
|
||||||
|
|
||||||
#### print(dpi, pageList) * _experimental_ *
|
|
||||||
* `dpi`: the print resolution of the document (try 100).
|
|
||||||
* `pageList`: the list (array) of pages to print.
|
|
||||||
|
|
||||||
### Public static methods
|
|
||||||
|
|
||||||
#### createLoadingTask(src[, options])
|
|
||||||
* `src`: see `:src` prop
|
|
||||||
* `options`: an object of options.
|
|
||||||
This function creates a PDFJS loading task that can be used and reused as `:src` property.
|
|
||||||
The loading task is a promise that resolves with the PDFJS pdf document that exposes the `numPages` property (see example below).
|
|
||||||
|
|
||||||
**beware:** when the component is destroyed, the object returned by `createLoadingTask()` become invalid.
|
|
||||||
|
|
||||||
Supported options:
|
|
||||||
* onPassword: Callback that's called when a password protected PDF is being opened.
|
|
||||||
* onProgress: Callback return loading progress.
|
|
||||||
* withCredentials: Wheter or not to send cookies in the fetch request.
|
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
##### Example - current page / page count
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
{{currentPage}} / {{pageCount}}
|
|
||||||
<pdf
|
|
||||||
src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"
|
|
||||||
@num-pages="pageCount = $event"
|
|
||||||
@page-loaded="currentPage = $event"
|
|
||||||
></pdf>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import pdf from 'vue-pdf'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
pdf
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
currentPage: 0,
|
|
||||||
pageCount: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
##### Example - display multiple pages of the same pdf document
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<pdf
|
|
||||||
v-for="i in numPages"
|
|
||||||
:key="i"
|
|
||||||
:src="src"
|
|
||||||
:page="i"
|
|
||||||
style="display: inline-block; width: 25%"
|
|
||||||
></pdf>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import pdf from 'vue-pdf'
|
|
||||||
|
|
||||||
var loadingTask = pdf.createLoadingTask('https://cdn.mozilla.net/pdfjs/tracemonkey.pdf');
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
pdf
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
src: loadingTask,
|
|
||||||
numPages: undefined,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
this.src.promise.then(pdf => {
|
|
||||||
|
|
||||||
this.numPages = pdf.numPages;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
##### Example - print all pages
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<button @click="$refs.myPdfComponent.print()">print</button>
|
|
||||||
<pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf>
|
|
||||||
</template>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
##### Example - print multiple pages
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<button @click="$refs.myPdfComponent.print(100, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])">print</button>
|
|
||||||
<pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf>
|
|
||||||
</template>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
##### Example - get text content
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
@click="logContent"
|
|
||||||
>
|
|
||||||
log content
|
|
||||||
</button>
|
|
||||||
<pdf
|
|
||||||
ref="myPdfComponent"
|
|
||||||
src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"
|
|
||||||
></pdf>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import pdf from 'vue-pdf'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
pdf
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
logContent() {
|
|
||||||
|
|
||||||
this.$refs.myPdfComponent.pdf.forEachPage(function(page) {
|
|
||||||
|
|
||||||
return page.getTextContent()
|
|
||||||
.then(function(content) {
|
|
||||||
|
|
||||||
var text = content.items.map(item => item.str);
|
|
||||||
console.log(text);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
##### Example - complete
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" v-model="show">
|
|
||||||
<select v-model="src" style="width: 30em">
|
|
||||||
<option v-for="item in pdfList" :value="item" v-text="item"></option>
|
|
||||||
</select>
|
|
||||||
<input v-model.number="page" type="number" style="width: 5em"> /{{numPages}}
|
|
||||||
<button @click="rotate += 90">⟳</button>
|
|
||||||
<button @click="rotate -= 90">⟲</button>
|
|
||||||
<button @click="$refs.pdf.print()">print</button>
|
|
||||||
<div style="width: 50%">
|
|
||||||
<div v-if="loadedRatio > 0 && loadedRatio < 1" style="background-color: green; color: white; text-align: center" :style="{ width: loadedRatio * 100 + '%' }">{{ Math.floor(loadedRatio * 100) }}%</div>
|
|
||||||
<pdf v-if="show" ref="pdf" style="border: 1px solid red" :src="src" :page="page" :rotate="rotate" @password="password" @progress="loadedRatio = $event" @error="error" @num-pages="numPages = $event" @link-clicked="page = $event"></pdf>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import pdf from 'vue-pdf'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
pdf: pdf
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
show: true,
|
|
||||||
pdfList: [
|
|
||||||
'',
|
|
||||||
'https://cdn.mozilla.net/pdfjs/tracemonkey.pdf',
|
|
||||||
'https://cdn.rawgit.com/mozilla/pdf.js/c6e8ca86/test/pdfs/freeculture.pdf',
|
|
||||||
'https://cdn.rawgit.com/mozilla/pdf.js/c6e8ca86/test/pdfs/annotation-link-text-popup.pdf',
|
|
||||||
'https://cdn.rawgit.com/mozilla/pdf.js/c6e8ca86/test/pdfs/calrgb.pdf',
|
|
||||||
'https://cdn.rawgit.com/sayanee/angularjs-pdf/68066e85/example/pdf/relativity.protected.pdf',
|
|
||||||
'data:application/pdf;base64,JVBERi0xLjUKJbXtrvsKMyAwIG9iago8PCAvTGVuZ3RoIDQgMCBSCiAgIC9GaWx0ZXIgL0ZsYXRlRGVjb2RlCj4+CnN0cmVhbQp4nE2NuwoCQQxF+/mK+wMbk5lkHl+wIFislmIhPhYEi10Lf9/MVgZCAufmZAkMppJ6+ZLUuFWsM3ZXxvzpFNaMYjEriqpCtbZSBOsDzw0zjqPHZYtTrEmz4eto7/0K54t7GfegOGCBbBdDH3+y2zsMsVERc9SoRkXORqKGJupS6/9OmMIUfgypJL4KZW5kc3RyZWFtCmVuZG9iago0IDAgb2JqCiAgIDEzOAplbmRvYmoKMiAwIG9iago8PAogICAvRXh0R1N0YXRlIDw8CiAgICAgIC9hMCA8PCAvQ0EgMC42MTE5ODcgL2NhIDAuNjExOTg3ID4+CiAgICAgIC9hMSA8PCAvQ0EgMSAvY2EgMSA+PgogICA+Pgo+PgplbmRvYmoKNSAwIG9iago8PCAvVHlwZSAvUGFnZQogICAvUGFyZW50IDEgMCBSCiAgIC9NZWRpYUJveCBbIDAgMCA1OTUuMjc1NTc0IDg0MS44ODk3NzEgXQogICAvQ29udGVudHMgMyAwIFIKICAgL0dyb3VwIDw8CiAgICAgIC9UeXBlIC9Hcm91cAogICAgICAvUyAvVHJhbnNwYXJlbmN5CiAgICAgIC9DUyAvRGV2aWNlUkdCCiAgID4+CiAgIC9SZXNvdXJjZXMgMiAwIFIKPj4KZW5kb2JqCjEgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzCiAgIC9LaWRzIFsgNSAwIFIgXQogICAvQ291bnQgMQo+PgplbmRvYmoKNiAwIG9iago8PCAvQ3JlYXRvciAoY2Fpcm8gMS4xMS4yIChodHRwOi8vY2Fpcm9ncmFwaGljcy5vcmcpKQogICAvUHJvZHVjZXIgKGNhaXJvIDEuMTEuMiAoaHR0cDovL2NhaXJvZ3JhcGhpY3Mub3JnKSkKPj4KZW5kb2JqCjcgMCBvYmoKPDwgL1R5cGUgL0NhdGFsb2cKICAgL1BhZ2VzIDEgMCBSCj4+CmVuZG9iagp4cmVmCjAgOAowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDA1ODAgMDAwMDAgbiAKMDAwMDAwMDI1MiAwMDAwMCBuIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDAyMzAgMDAwMDAgbiAKMDAwMDAwMDM2NiAwMDAwMCBuIAowMDAwMDAwNjQ1IDAwMDAwIG4gCjAwMDAwMDA3NzIgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA4CiAgIC9Sb290IDcgMCBSCiAgIC9JbmZvIDYgMCBSCj4+CnN0YXJ0eHJlZgo4MjQKJSVFT0YK',
|
|
||||||
],
|
|
||||||
src:'',
|
|
||||||
loadedRatio: 0,
|
|
||||||
page: 1,
|
|
||||||
numPages: 0,
|
|
||||||
rotate: 0,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
password: function(updatePassword, reason) {
|
|
||||||
|
|
||||||
updatePassword(prompt('password is "test"'));
|
|
||||||
},
|
|
||||||
error: function(err) {
|
|
||||||
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
[<img src="https://www.franck-freiburger.com/FF.png" width="16"> Franck Freiburger](https://www.franck-freiburger.com)
|
|
||||||
@ -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": {}
|
|
||||||
}
|
|
||||||
@ -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,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
@ -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;
|
|
||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
<style src="./annotationLayer.css"></style>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import componentFactory from './componentFactory.js'
|
|
||||||
|
|
||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
|
||||||
|
|
||||||
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
|
||||||
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
|
||||||
|
|
||||||
if ( typeof window !== 'undefined' && 'Worker' in window && navigator.appVersion.indexOf('MSIE 10') === -1 ) {
|
|
||||||
|
|
||||||
var PdfjsWorker = require('worker-loader!pdfjs-dist-sign/es5/build/pdf.worker.js');
|
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
|
||||||
}
|
|
||||||
|
|
||||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
var component = componentFactory({});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default component;
|
|
||||||
</script>
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<style src="./annotationLayer.css"></style>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import componentFactory from './componentFactory.js'
|
|
||||||
|
|
||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
|
||||||
|
|
||||||
var pdfjsWrapper = require('./pdfjsWrapper.js').default;
|
|
||||||
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
|
||||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
var component = componentFactory({});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default component;
|
|
||||||
</script>
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<style src="./annotationLayer.css"></style>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
import componentFactory from './componentFactory'
|
|
||||||
import pdfjsWrapper from './pdfjsWrapper'
|
|
||||||
|
|
||||||
var PDFJS = require('pdfjs-dist-sign/es5/build/pdf.js');
|
|
||||||
|
|
||||||
if ( process.env.VUE_ENV !== 'server' ) {
|
|
||||||
|
|
||||||
if ( typeof window !== 'undefined' && 'Worker' in window ) {
|
|
||||||
|
|
||||||
var PdfjsWorker = require('worker-loader!pdfjs-dist-sign/es5/build/pdf.worker.js');
|
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
|
||||||
component.PDFJS = PDFJS;
|
|
||||||
|
|
||||||
export default component;
|
|
||||||
|
|
||||||
</script>
|
|
||||||
21
libs/readme
21
libs/readme
@ -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
|
|
||||||
@ -113,8 +113,8 @@
|
|||||||
"vuedraggable": "^2.24.3",
|
"vuedraggable": "^2.24.3",
|
||||||
"vuex": "3.6.0",
|
"vuex": "3.6.0",
|
||||||
"watermark-dom": "2.3.0",
|
"watermark-dom": "2.3.0",
|
||||||
"xd-pdf": "./libs/XdPdf",
|
"xd-pdf": "1.0.0",
|
||||||
"xd-vue-pdf": "./libs/XdVuePdf",
|
"xd-vue-pdf": "3.0.0",
|
||||||
"xlsx": "^0.17.5"
|
"xlsx": "^0.17.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user