@toolspack/ttd-pdfjs 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +5 -0
- package/README.md +2 -1
- package/lib/ttd-pdfjs.common.js +9033 -8896
- package/lib/ttd-pdfjs.umd.js +9033 -8896
- package/lib/ttd-pdfjs.umd.min.js +4 -4
- package/package.json +9 -7
- package/src/App.vue +1 -1
- package/src/main.js +5 -5
- package/src/packages/index.js +4 -2
- package/src/packages/pdfjs/{PdfView216.vue → PdfView.vue} +13 -5
- package/src/packages/pdfjs/SwitchPage.vue +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toolspack/ttd-pdfjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/ttd-pdfjs.umd.min.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,30 +10,32 @@
|
|
|
10
10
|
"lint": "vue-cli-service lint --max-warnings 100"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"babel-
|
|
14
|
-
"babel-laoder": "0.0.1-security",
|
|
15
|
-
"babel-polyfill": "^6.26.0",
|
|
16
|
-
"core-js": "^3.34.0",
|
|
13
|
+
"babel-loader": "^10.0.0",
|
|
17
14
|
"element-ui": "^2.15.14",
|
|
18
|
-
"less": "^3.8.1",
|
|
19
|
-
"less-loader": "^4.1.0",
|
|
20
15
|
"pdfjs-dist": "3.11.174",
|
|
21
16
|
"vue": "^2.6.12"
|
|
22
17
|
},
|
|
23
18
|
"devDependencies": {
|
|
24
19
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
20
|
+
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
|
|
25
21
|
"@vue/cli-plugin-babel": "~4.5.11",
|
|
26
22
|
"@vue/cli-plugin-eslint": "~4.5.11",
|
|
27
23
|
"@vue/cli-service": "^4.5.11",
|
|
28
24
|
"@vue/eslint-config-airbnb": "^5.3.0",
|
|
25
|
+
"babel-cli": "^6.26.0",
|
|
29
26
|
"babel-eslint": "^10.1.0",
|
|
30
27
|
"babel-plugin-component": "^1.1.1",
|
|
28
|
+
"babel-polyfill": "^6.26.0",
|
|
31
29
|
"babel-preset-es2015": "^6.24.1",
|
|
30
|
+
"core-js": "^3.34.0",
|
|
32
31
|
"eslint": "^6.7.2",
|
|
33
32
|
"eslint-plugin-import": "^2.22.1",
|
|
34
33
|
"eslint-plugin-node": "^11.1.0",
|
|
35
34
|
"eslint-plugin-promise": "^4.2.1",
|
|
36
35
|
"eslint-plugin-vue": "^6.2.2",
|
|
36
|
+
"file-loader": "^6.2.0",
|
|
37
|
+
"less": "^3.8.1",
|
|
38
|
+
"less-loader": "^4.1.0",
|
|
37
39
|
"vue-template-compiler": "^2.6.12"
|
|
38
40
|
}
|
|
39
41
|
}
|
package/src/App.vue
CHANGED
package/src/main.js
CHANGED
|
@@ -6,11 +6,11 @@ import App from './App.vue';
|
|
|
6
6
|
|
|
7
7
|
Vue.config.productionTip = false;
|
|
8
8
|
|
|
9
|
-
Vue.
|
|
10
|
-
Vue.
|
|
11
|
-
Vue.
|
|
12
|
-
Vue.
|
|
13
|
-
Vue.
|
|
9
|
+
Vue.use(Button);
|
|
10
|
+
Vue.use(Input);
|
|
11
|
+
Vue.use(Upload);
|
|
12
|
+
Vue.use(Select);
|
|
13
|
+
Vue.use(Option);
|
|
14
14
|
|
|
15
15
|
new Vue({
|
|
16
16
|
render: (h) => h(App),
|
package/src/packages/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:page="page" :zoomEnable="zoomEnable" :rotateEnable="rotateEnable"
|
|
6
6
|
@page="onChangePage" @zoom="onScale" @rotate="onRotate"></switch-page>
|
|
7
7
|
</div>
|
|
8
|
-
<div class="pdf-view-area-wapper"
|
|
8
|
+
<div class="pdf-view-area-wapper">
|
|
9
9
|
<div>
|
|
10
10
|
<div
|
|
11
11
|
class="center pdf-view-area"
|
|
@@ -55,18 +55,20 @@ if (getChromeVersion()) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// const PDFJS = require('pdfjs-dist/legacy/build/pdf.js')
|
|
59
58
|
const PDFJS = require('pdfjs-dist')
|
|
60
59
|
|
|
61
60
|
const defautScale = 1.0
|
|
62
61
|
// PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/legacy/build/pdf.worker.min.js')
|
|
62
|
+
// eslint-disable-next-line
|
|
63
63
|
PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.min.js')
|
|
64
64
|
// https://unpkg.com/pdfjs-dist@2.16.105/cmaps/
|
|
65
|
-
// const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
|
|
66
65
|
// 使用代理的cmaps,会导致加载很慢,改用本地
|
|
67
|
-
|
|
66
|
+
// const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
|
|
68
67
|
const cMapUrl = 'https://wsp.totodi.com/staticfiles_web/web/pdfjs/cmaps/'
|
|
69
68
|
|
|
69
|
+
PDFJS.cMapPacked = true
|
|
70
|
+
PDFJS.cMapUrl = cMapUrl
|
|
71
|
+
|
|
70
72
|
export const maxscale = 3
|
|
71
73
|
export const minscale = 0.2
|
|
72
74
|
|
|
@@ -173,7 +175,10 @@ export default {
|
|
|
173
175
|
vm.isready = true
|
|
174
176
|
|
|
175
177
|
const { canvas } = vm.$refs
|
|
176
|
-
|
|
178
|
+
if (!canvas) {
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
this.style.width = `${viewport.width + 18}px`;
|
|
177
182
|
this.pdfWidth = `${viewport.width}px`;
|
|
178
183
|
canvas.height = viewport.height
|
|
179
184
|
canvas.width = viewport.width
|
|
@@ -374,6 +379,7 @@ export default {
|
|
|
374
379
|
width: 100%;
|
|
375
380
|
display: flex;
|
|
376
381
|
flex-direction: column;
|
|
382
|
+
box-sizing: border-box;
|
|
377
383
|
min-width: 688px;
|
|
378
384
|
}
|
|
379
385
|
.pdf-view-control {
|
|
@@ -385,10 +391,12 @@ export default {
|
|
|
385
391
|
overflow: auto;
|
|
386
392
|
width: 100%;
|
|
387
393
|
flex-shrink: 0%;
|
|
394
|
+
box-sizing: border-box;
|
|
388
395
|
}
|
|
389
396
|
.pdf-view-area {
|
|
390
397
|
position: relative;
|
|
391
398
|
min-height: 100px;
|
|
399
|
+
box-sizing: border-box;
|
|
392
400
|
.canvasstyle {
|
|
393
401
|
display: block;
|
|
394
402
|
margin: 0 auto;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
34
|
<script>
|
|
35
|
-
import { maxscale, minscale } from './
|
|
35
|
+
import { maxscale, minscale } from './PdfView.vue'
|
|
36
36
|
|
|
37
37
|
export const EnumOptions = [
|
|
38
38
|
// { label: '自动缩放', value: '' },
|
|
@@ -194,5 +194,10 @@ export default {
|
|
|
194
194
|
display: none;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
+
@container (max-width: 731px) {
|
|
198
|
+
.hidden-text {
|
|
199
|
+
display: none;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
197
202
|
}
|
|
198
203
|
</style>
|