@toolspack/ttd-pdfjs 0.1.4 → 0.1.5
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 +9178 -9042
- package/lib/ttd-pdfjs.umd.js +9178 -9042
- 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} +8 -4
- 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.5",
|
|
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" :style="{width: pdfWidth}" >
|
|
9
9
|
<div>
|
|
10
10
|
<div
|
|
11
11
|
class="center pdf-view-area"
|
|
@@ -55,18 +55,19 @@ 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')
|
|
63
62
|
PDFJS.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.min.js')
|
|
64
63
|
// https://unpkg.com/pdfjs-dist@2.16.105/cmaps/
|
|
65
|
-
// const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
|
|
66
64
|
// 使用代理的cmaps,会导致加载很慢,改用本地
|
|
67
|
-
|
|
65
|
+
// const cMapUrl = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174/cmaps/'
|
|
68
66
|
const cMapUrl = 'https://wsp.totodi.com/staticfiles_web/web/pdfjs/cmaps/'
|
|
69
67
|
|
|
68
|
+
PDFJS.cMapPacked = true
|
|
69
|
+
PDFJS.cMapUrl = cMapUrl
|
|
70
|
+
|
|
70
71
|
export const maxscale = 3
|
|
71
72
|
export const minscale = 0.2
|
|
72
73
|
|
|
@@ -173,6 +174,9 @@ export default {
|
|
|
173
174
|
vm.isready = true
|
|
174
175
|
|
|
175
176
|
const { canvas } = vm.$refs
|
|
177
|
+
if (!canvas) {
|
|
178
|
+
return false
|
|
179
|
+
}
|
|
176
180
|
this.style.width = `${viewport.width + 2}px`;
|
|
177
181
|
this.pdfWidth = `${viewport.width}px`;
|
|
178
182
|
canvas.height = viewport.height
|
|
@@ -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>
|