@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolspack/ttd-pdfjs",
3
- "version": "0.1.4",
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-cli": "^6.26.0",
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
@@ -20,7 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
- import PdfView from './packages/pdfjs/PdfView216.vue'
23
+ import PdfView from './packages/pdfjs/PdfView.vue'
24
24
 
25
25
  const mybaseUrl = 'https://petx.totodi.com/'
26
26
 
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.component(Button.name, Button);
10
- Vue.component(Input.name, Input);
11
- Vue.component(Upload.name, Upload);
12
- Vue.component(Select.name, Select);
13
- Vue.component(Option.name, Option);
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),
@@ -1,5 +1,7 @@
1
- import PdfView216 from './pdfjs/PdfView216.vue'
1
+ import PdfView from './pdfjs/PdfView.vue'
2
+ import SwitchPage from './pdfjs/SwitchPage.vue'
2
3
 
3
4
  export default {
4
- PdfView216,
5
+ PdfView,
6
+ SwitchPage,
5
7
  }
@@ -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" :width="pdfWidth">
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 './PdfView216.vue'
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>