md
This commit is contained in:
parent
5b315e5cf5
commit
bd3176be15
@ -7,7 +7,7 @@ ENV = 'development'
|
||||
# 开发环境
|
||||
#VUE_APP_BASE_API = '/dev-api'
|
||||
VUE_APP_PDOMAIN = 'tanex56-oms'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/omssvr'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/oms'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
@ -6,4 +6,4 @@ ENV = 'production'
|
||||
|
||||
# 管理系统/生产环境
|
||||
VUE_APP_PDOMAIN = 'tanex56-oms'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/omssvr'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/oms'
|
||||
|
||||
@ -9,4 +9,4 @@ ENV = 'staging'
|
||||
# 测试环境
|
||||
VUE_APP_BASE_API = '/stage-api'
|
||||
VUE_APP_PDOMAIN = 'tanex56-oms'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/omssvr'
|
||||
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/oms'
|
||||
|
||||
11
README.md
11
README.md
@ -65,6 +65,10 @@ npm install --save @antv/hierarchy
|
||||
|
||||
npm install vue-chartjs
|
||||
|
||||
npm install uuid --save
|
||||
|
||||
npm i @fingerprintjs/fingerprintjs
|
||||
|
||||
```
|
||||
|
||||
npm install -save dayjs
|
||||
@ -82,7 +86,14 @@ 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,2 +1,3 @@
|
||||
rm -rf dist
|
||||
git pull
|
||||
yarn run build:prod
|
||||
237
libs/XdPdf/XdPdf.vue
Normal file
237
libs/XdPdf/XdPdf.vue
Normal file
@ -0,0 +1,237 @@
|
||||
<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>
|
||||
30
libs/XdPdf/package.json
Normal file
30
libs/XdPdf/package.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"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": {}
|
||||
}
|
||||
3
libs/XdVuePdf/.babelrc
Normal file
3
libs/XdVuePdf/.babelrc
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["syntax-dynamic-import"]
|
||||
}
|
||||
40
libs/XdVuePdf/.gitignore
vendored
Normal file
40
libs/XdVuePdf/.gitignore
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# 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
|
||||
40
libs/XdVuePdf/.npmignore
Normal file
40
libs/XdVuePdf/.npmignore
Normal file
@ -0,0 +1,40 @@
|
||||
# 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
|
||||
17
libs/XdVuePdf/ISSUE_TEMPLATE.md
Normal file
17
libs/XdVuePdf/ISSUE_TEMPLATE.md
Normal file
@ -0,0 +1,17 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
21
libs/XdVuePdf/LICENSE
Normal file
21
libs/XdVuePdf/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
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.
|
||||
296
libs/XdVuePdf/README.md
Normal file
296
libs/XdVuePdf/README.md
Normal file
@ -0,0 +1,296 @@
|
||||
# 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)
|
||||
31
libs/XdVuePdf/package.json
Normal file
31
libs/XdVuePdf/package.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "xd-vue-pdf",
|
||||
"version": "1.0.0",
|
||||
"description": "vue.js pdf viewer",
|
||||
"main": "src/vuePdfNoSss.vue",
|
||||
"scripts": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/FranckFreiburger/vue-pdf.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue.js",
|
||||
"pdf",
|
||||
"viewer"
|
||||
],
|
||||
"author": "Franck FREIBURGER",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/FranckFreiburger/vue-pdf/issues"
|
||||
},
|
||||
"homepage": "https://github.com/FranckFreiburger/vue-pdf#readme",
|
||||
"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": {}
|
||||
}
|
||||
18
libs/XdVuePdf/src/CMapReaderFactory.js
Normal file
18
libs/XdVuePdf/src/CMapReaderFactory.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { CMapCompressionType } from 'pdfjs-dist/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/cmaps/'+query.name+'.bcmap' /* webpackChunkName: "noprefetch-[request]" */)
|
||||
.then(function(bcmap) {
|
||||
|
||||
return {
|
||||
cMapData: bcmap.default,
|
||||
compressionType: CMapCompressionType.BINARY,
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
144
libs/XdVuePdf/src/annotationLayer.css
Normal file
144
libs/XdVuePdf/src/annotationLayer.css
Normal file
@ -0,0 +1,144 @@
|
||||
/* 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;
|
||||
}
|
||||
16
libs/XdVuePdf/src/buffer-loader.js
Normal file
16
libs/XdVuePdf/src/buffer-loader.js
Normal file
@ -0,0 +1,16 @@
|
||||
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;
|
||||
111
libs/XdVuePdf/src/componentFactory.js
Normal file
111
libs/XdVuePdf/src/componentFactory.js
Normal file
@ -0,0 +1,111 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
387
libs/XdVuePdf/src/pdfjsWrapper.js
Normal file
387
libs/XdVuePdf/src/pdfjsWrapper.js
Normal file
@ -0,0 +1,387 @@
|
||||
import { PDFLinkService } from 'pdfjs-dist/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;
|
||||
|
||||
if ( options && options.withCredentials )
|
||||
source.withCredentials = options.withCredentials;
|
||||
|
||||
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 printContainerElement = document.createElement('div');
|
||||
printContainerElement.setAttribute('id', 'print-container')
|
||||
|
||||
|
||||
function removePrintContainer() {
|
||||
printContainerElement.parentNode.removeChild(printContainerElement);
|
||||
|
||||
}
|
||||
|
||||
new Promise(function(resolve, reject) {
|
||||
|
||||
printContainerElement.frameBorder = '0';
|
||||
printContainerElement.scrolling = 'no';
|
||||
printContainerElement.width = '0px;'
|
||||
printContainerElement.height = '0px;'
|
||||
printContainerElement.style.cssText = 'position: absolute; top: 0; left: 0';
|
||||
|
||||
window.document.body.appendChild(printContainerElement);
|
||||
resolve(window)
|
||||
})
|
||||
.then(function(win) {
|
||||
|
||||
win.document.title = '';
|
||||
|
||||
return pdfDoc.getPage(1)
|
||||
.then(function(page) {
|
||||
|
||||
var viewport = page.getViewport({ scale: 1 });
|
||||
printContainerElement.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; }' +
|
||||
'}' +
|
||||
'#print-canvas { display: none }' +
|
||||
'@media print {' +
|
||||
'body { margin: 0 }' +
|
||||
'#print-canvas { page-break-before: avoid; page-break-after: always; page-break-inside: avoid; display: block }' +
|
||||
'body > *:not(#print-container) { display: none; }' +
|
||||
'}'+
|
||||
|
||||
'@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 = printContainerElement.appendChild(win.document.createElement('canvas'));
|
||||
printCanvasElt.setAttribute('id', 'print-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();
|
||||
}
|
||||
removePrintContainer();
|
||||
})
|
||||
.catch(function(err) {
|
||||
removePrintContainer();
|
||||
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,
|
||||
}
|
||||
}
|
||||
24
libs/XdVuePdf/src/vuePdfNoSss.vue
Normal file
24
libs/XdVuePdf/src/vuePdfNoSss.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<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/es5/build/pdf.js');
|
||||
|
||||
if ( typeof window !== 'undefined' && 'Worker' in window && navigator.appVersion.indexOf('MSIE 10') === -1 ) {
|
||||
|
||||
var PdfjsWorker = require('worker-loader!pdfjs-dist/es5/build/pdf.worker.js');
|
||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
||||
}
|
||||
|
||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
||||
} else {
|
||||
|
||||
var component = componentFactory({});
|
||||
}
|
||||
|
||||
export default component;
|
||||
</script>
|
||||
17
libs/XdVuePdf/src/vuePdfNoSssNoWorker.vue
Normal file
17
libs/XdVuePdf/src/vuePdfNoSssNoWorker.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<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/es5/build/pdf.js');
|
||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
||||
} else {
|
||||
|
||||
var component = componentFactory({});
|
||||
}
|
||||
|
||||
export default component;
|
||||
</script>
|
||||
23
libs/XdVuePdf/src/vuePdfSss.vue
Normal file
23
libs/XdVuePdf/src/vuePdfSss.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<style src="./annotationLayer.css"></style>
|
||||
<script>
|
||||
|
||||
import componentFactory from './componentFactory'
|
||||
import pdfjsWrapper from './pdfjsWrapper'
|
||||
|
||||
var PDFJS = require('pdfjs-dist/es5/build/pdf.js');
|
||||
|
||||
if ( process.env.VUE_ENV !== 'server' ) {
|
||||
|
||||
if ( typeof window !== 'undefined' && 'Worker' in window ) {
|
||||
|
||||
var PdfjsWorker = require('worker-loader!pdfjs-dist/es5/build/pdf.worker.js');
|
||||
PDFJS.GlobalWorkerOptions.workerPort = new PdfjsWorker();
|
||||
}
|
||||
}
|
||||
|
||||
var component = componentFactory(pdfjsWrapper(PDFJS));
|
||||
component.PDFJS = PDFJS;
|
||||
|
||||
export default component;
|
||||
|
||||
</script>
|
||||
32
package.json
32
package.json
@ -36,22 +36,22 @@
|
||||
"url": "http://git.xdadan.com/smshen/DTMicroPlat.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"watermark-dom": "2.3.0",
|
||||
"@antv/g6": "^4.8.21",
|
||||
"@antv/hierarchy": "^0.6.11",
|
||||
"@antv/layout": "^0.3.23",
|
||||
"@antv/x6": "^2.13.1",
|
||||
"@antv/x6-vue-shape": "^2.1.1",
|
||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||
"@fingerprintjs/fingerprintjs": "^4.3.0",
|
||||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"axios": "0.24.0",
|
||||
"clipboard": "2.0.8",
|
||||
"codemirror": "^6.0.1",
|
||||
"coordtransform": "^2.1.2",
|
||||
"core-js": "^3.32.1",
|
||||
"dayjs": "^1.11.10",
|
||||
"default-passive-events": "^2.0.0",
|
||||
"echarts": "4.9.0",
|
||||
"element-china-area-data": "^6.1.0",
|
||||
"element-ui": "2.15.6",
|
||||
"exceljs": "^4.3.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"fingerprintjs2": "^2.1.4",
|
||||
"font-awesome": "^4.7.0",
|
||||
"fuse.js": "6.4.3",
|
||||
"highlight.js": "^9.18.5",
|
||||
@ -61,9 +61,11 @@
|
||||
"js-beautify": "1.13.0",
|
||||
"js-cookie": "3.0.1",
|
||||
"js-md5": "^0.7.3",
|
||||
"jsbarcode": "^3.11.5",
|
||||
"jsbarcode": "^3.11.6",
|
||||
"jsencrypt": "3.2.1",
|
||||
"jsmind": "^0.4.11",
|
||||
"jspdf": "^2.5.1",
|
||||
"loader-utils": "^3.3.1",
|
||||
"lodash": "^4.17.21",
|
||||
"luckyexcel": "^1.0.1",
|
||||
"marked": "^4.3.0",
|
||||
@ -71,25 +73,38 @@
|
||||
"monaco-editor": "^0.34.1",
|
||||
"mxgraph-js": "^1.0.1",
|
||||
"nprogress": "0.2.0",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdfjs-dist": "^2.5.207",
|
||||
"print-js": "^1.6.0",
|
||||
"qrcodejs2": "^0.0.2",
|
||||
"quill": "1.3.7",
|
||||
"require.js": "^1.0.0",
|
||||
"save-svg-as-png": "^1.4.17",
|
||||
"screenfull": "5.0.2",
|
||||
"sortablejs": "1.10.2",
|
||||
"uuid": "^9.0.1",
|
||||
"vue": "2.7.0",
|
||||
"vue-amap": "^0.5.10",
|
||||
"vue-barcode": "^1.3.0",
|
||||
"vue-buffer": "^0.0.1",
|
||||
"vue-clipboard2": "^0.3.3",
|
||||
"vue-count-to": "1.0.13",
|
||||
"vue-cropper": "0.5.5",
|
||||
"vue-grid-layout": "^2.4.0",
|
||||
"vue-i18n": "^8.28.2",
|
||||
"vue-meta": "2.4.0",
|
||||
"vue-okr-tree": "^1.0.17",
|
||||
"vue-pdf": "^4.2.0",
|
||||
"vue-print-nb": "^1.7.5",
|
||||
"vue-property-decorator": "^9.1.2",
|
||||
"vue-resize-sensor": "^2.0.0",
|
||||
"vue-router": "3.4.9",
|
||||
"vue-virtual-scroller": "^1.1.2",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "3.6.0",
|
||||
"watermark-dom": "2.3.0",
|
||||
"xd-pdf": "./libs/XdPdf",
|
||||
"xd-vue-pdf": "file:libs/XdVuePdf",
|
||||
"xlsx": "^0.17.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -101,14 +116,17 @@
|
||||
"chalk": "4.1.0",
|
||||
"compression-webpack-plugin": "5.0.2",
|
||||
"connect": "3.6.6",
|
||||
"el-tree-select": "^3.1.14",
|
||||
"eslint": "7.15.0",
|
||||
"eslint-plugin-vue": "7.2.0",
|
||||
"hard-source-webpack-plugin": "^0.13.1",
|
||||
"lint-staged": "10.5.3",
|
||||
"runjs": "4.4.2",
|
||||
"sass": "1.32.13",
|
||||
"sass-loader": "10.1.1",
|
||||
"script-ext-html-webpack-plugin": "2.1.5",
|
||||
"script-loader": "^0.7.2",
|
||||
"speed-measure-webpack-plugin": "^1.5.0",
|
||||
"svg-sprite-loader": "5.1.1",
|
||||
"vue-template-compiler": "2.6.12",
|
||||
"webpack-bundle-analyzer": "^4.9.1"
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"/>
|
||||
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> -->
|
||||
<link rel="icon" href="<%= BASE_URL %>shorticon.png"/>
|
||||
<link rel="manifest" href="/manifest.json"/>
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
@ -209,4 +210,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
26
public/manifest copy.json
Normal file
26
public/manifest copy.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"short_name": "XDADAN",
|
||||
"name": "XDADAN",
|
||||
"description": "XDADAN 是一款适合多业务的云平台系统",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#FFFFFF",
|
||||
"orientation": "portrait"
|
||||
}
|
||||
@ -3,21 +3,7 @@
|
||||
"name": "XDADAN",
|
||||
"description": "XDADAN 是一款适合多业务的云平台系统",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "favicon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
|
||||
BIN
public/shorticon.png
Normal file
BIN
public/shorticon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
67
public/socket_test.html
Normal file
67
public/socket_test.html
Normal file
@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>websocket通讯</title>
|
||||
</head>
|
||||
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
|
||||
<script>
|
||||
var socket;
|
||||
function openSocket() {
|
||||
if(typeof(WebSocket) == "undefined") {
|
||||
console.log("您的浏览器不支持WebSocket");
|
||||
}else{
|
||||
console.log("您的浏览器支持WebSocket");
|
||||
//实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接
|
||||
//等同于socket = new WebSocket("ws://localhost:8888/xxxx/im/25");
|
||||
//var socketUrl="${request.contextPath}/im/"+$("#userId").val();
|
||||
// var socketUrl="http://192.168.88.57:11089/api/bizsvr/ws/1";
|
||||
var socketUrl="http://47.102.220.189:58089/api/bizsvr/ws/1";
|
||||
|
||||
|
||||
socketUrl=socketUrl.replace("https","ws").replace("http","ws");
|
||||
console.log(socketUrl);
|
||||
if(socket!=null){
|
||||
socket.close();
|
||||
socket=null;
|
||||
}
|
||||
socket = new WebSocket(socketUrl);
|
||||
//打开事件
|
||||
socket.onopen = function() {
|
||||
console.log("websocket已打开");
|
||||
//socket.send("这是来自客户端的消息" + location.href + new Date());
|
||||
};
|
||||
//获得消息事件
|
||||
socket.onmessage = function(msg) {
|
||||
console.log(msg.data);
|
||||
//发现消息进入 开始处理前端触发逻辑
|
||||
};
|
||||
//关闭事件
|
||||
socket.onclose = function() {
|
||||
console.log("websocket已关闭");
|
||||
};
|
||||
//发生了错误事件
|
||||
socket.onerror = function() {
|
||||
console.log("websocket发生了错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
function sendMessage() {
|
||||
if(typeof(WebSocket) == "undefined") {
|
||||
console.log("您的浏览器不支持WebSocket");
|
||||
}else {
|
||||
console.log("您的浏览器支持WebSocket");
|
||||
console.log('{"toUserId":"'+$("#toUserId").val()+'","contentText":"'+$("#contentText").val()+'"}');
|
||||
socket.send('{"toUserId":"'+$("#toUserId").val()+'","contentText":"'+$("#contentText").val()+'"}');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<p>【userId】:<div><input id="ip" name="ip" type="text" value="192.168.1.1"></div>
|
||||
<p>【toUserId】:<div><input id="toUserId" name="toUserId" type="text" value="192.168.1.100"></div>
|
||||
<p>【toUserId】:<div><input id="contentText" name="contentText" type="text" value="hello websocket"></div>
|
||||
<p>【操作】:<div><a onclick="openSocket()">开启socket</a></div>
|
||||
<p>【操作】:<div><a onclick="sendMessage()">发送消息</a></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
public/static/cmaps/78-EUC-H.bcmap
Normal file
BIN
public/static/cmaps/78-EUC-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78-EUC-V.bcmap
Normal file
BIN
public/static/cmaps/78-EUC-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78-H.bcmap
Normal file
BIN
public/static/cmaps/78-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/78-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/78-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78-V.bcmap
Normal file
BIN
public/static/cmaps/78-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78ms-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/78ms-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/78ms-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/78ms-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/83pv-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/83pv-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90ms-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/90ms-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90ms-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/90ms-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90msp-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/90msp-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90msp-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/90msp-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90pv-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/90pv-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/90pv-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/90pv-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Add-H.bcmap
Normal file
BIN
public/static/cmaps/Add-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Add-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/Add-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Add-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/Add-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Add-V.bcmap
Normal file
BIN
public/static/cmaps/Add-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-0.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-0.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-1.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-1.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-3.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-3.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-4.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-4.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-5.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-5.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-6.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-6.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-CNS1-UCS2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-CNS1-UCS2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-0.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-0.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-1.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-1.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-3.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-3.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-4.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-4.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-5.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-5.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-GB1-UCS2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-GB1-UCS2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-0.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-0.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-1.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-1.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-3.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-3.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-4.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-4.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-5.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-5.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-6.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-6.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Japan1-UCS2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Japan1-UCS2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Korea1-0.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Korea1-0.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Korea1-1.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Korea1-1.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Korea1-2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Korea1-2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Adobe-Korea1-UCS2.bcmap
Normal file
BIN
public/static/cmaps/Adobe-Korea1-UCS2.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/B5-H.bcmap
Normal file
BIN
public/static/cmaps/B5-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/B5-V.bcmap
Normal file
BIN
public/static/cmaps/B5-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/B5pc-H.bcmap
Normal file
BIN
public/static/cmaps/B5pc-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/B5pc-V.bcmap
Normal file
BIN
public/static/cmaps/B5pc-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/CNS-EUC-H.bcmap
Normal file
BIN
public/static/cmaps/CNS-EUC-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/CNS-EUC-V.bcmap
Normal file
BIN
public/static/cmaps/CNS-EUC-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/CNS1-H.bcmap
Normal file
BIN
public/static/cmaps/CNS1-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/CNS1-V.bcmap
Normal file
BIN
public/static/cmaps/CNS1-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/CNS2-H.bcmap
Normal file
BIN
public/static/cmaps/CNS2-H.bcmap
Normal file
Binary file not shown.
3
public/static/cmaps/CNS2-V.bcmap
Normal file
3
public/static/cmaps/CNS2-V.bcmap
Normal file
@ -0,0 +1,3 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSEáCNS2-H
|
||||
BIN
public/static/cmaps/ETHK-B5-H.bcmap
Normal file
BIN
public/static/cmaps/ETHK-B5-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/ETHK-B5-V.bcmap
Normal file
BIN
public/static/cmaps/ETHK-B5-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/ETen-B5-H.bcmap
Normal file
BIN
public/static/cmaps/ETen-B5-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/ETen-B5-V.bcmap
Normal file
BIN
public/static/cmaps/ETen-B5-V.bcmap
Normal file
Binary file not shown.
3
public/static/cmaps/ETenms-B5-H.bcmap
Normal file
3
public/static/cmaps/ETenms-B5-H.bcmap
Normal file
@ -0,0 +1,3 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSEá ETen-B5-H` ^
|
||||
BIN
public/static/cmaps/ETenms-B5-V.bcmap
Normal file
BIN
public/static/cmaps/ETenms-B5-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/EUC-H.bcmap
Normal file
BIN
public/static/cmaps/EUC-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/EUC-V.bcmap
Normal file
BIN
public/static/cmaps/EUC-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Ext-H.bcmap
Normal file
BIN
public/static/cmaps/Ext-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Ext-RKSJ-H.bcmap
Normal file
BIN
public/static/cmaps/Ext-RKSJ-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Ext-RKSJ-V.bcmap
Normal file
BIN
public/static/cmaps/Ext-RKSJ-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/Ext-V.bcmap
Normal file
BIN
public/static/cmaps/Ext-V.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/GB-EUC-H.bcmap
Normal file
BIN
public/static/cmaps/GB-EUC-H.bcmap
Normal file
Binary file not shown.
BIN
public/static/cmaps/GB-EUC-V.bcmap
Normal file
BIN
public/static/cmaps/GB-EUC-V.bcmap
Normal file
Binary file not shown.
4
public/static/cmaps/GB-H.bcmap
Normal file
4
public/static/cmaps/GB-H.bcmap
Normal file
@ -0,0 +1,4 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSE!!<21>º]aX!!]`<60>21<32>> <09>p<0B>z<EFBFBD>$]‚<06>"R‚d<E2809A>-Uƒ7<C692>*„
4„%<25>+ „Z „{<7B>/…%…<<3C>9K…b<E280A6>1]†.<2E>"‡‰`]‡,<2C>"]ˆ
|
||||
<EFBFBD>"]ˆh<CB86>"]‰F<E280B0>"]Š$<24>"]‹<02>"]‹`<60>"]Œ><3E>"]<5D><1C>"]<5D>z<EFBFBD>"]ŽX<C5BD>"]<5D>6<EFBFBD>"]<5D><14>"]<5D>r<EFBFBD>"]‘P<E28098>"]’.<2E>"]“<0C>"]“j<E2809C>"]”H<E2809D>"]•&<26>"]–<04>"]–b<E28093>"]—@<40>"]˜<1E>"]˜|<7C>"]™Z<E284A2>"]š8<C5A1>"]›<16>"]›t<E280BA>"]œR<C593>"]<5D>0<EFBFBD>"]ž<0E>"]žl<C5BE>"]ŸJ<C5B8>"] (<28>"]¡<06>"]¡d<C2A1>"]¢B<C2A2>"]£ <20>"X£~<7E>']¤W<C2A4>"]¥5<C2A5>"]¦<13>"]¦q<C2A6>"]§O<C2A7>"]¨-<2D>"]©<0B>"]©i<C2A9>"]ªG<C2AA>"]«%<25>"]¬<03>"]¬a<C2AC>"]?<3F>"]®<1D>"]®{<7B>"]¯Y<C2AF>"]°7<C2B0>"]±<15>"]±s<C2B1>"]²Q<C2B2>"]³/<2F>"]´
<0A>"]´k<C2B4>"]µI<C2B5>"]¶'<27>"]·<05>"]·c<C2B7>"]¸A<C2B8>"]¹<1F>"]¹}<7D>"]º[<5B>"]»9
|
||||
BIN
public/static/cmaps/GB-V.bcmap
Normal file
BIN
public/static/cmaps/GB-V.bcmap
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user