pdf增加staticFileUrl属性,解决发票预览不全问题

This commit is contained in:
liyulin 2022-12-29 12:03:16 +08:00
parent b7367dd535
commit 69005ef93c
360 changed files with 209 additions and 60 deletions

View File

@ -10,7 +10,8 @@ export default {
name: "PdfDemo",
data(){
return {
src:'http://static.shanhuxueyuan.com/test.pdf'
// src:'http://static.shanhuxueyuan.com/test.pdf'
src:'http://static.shanhuxueyuan.com/test/fapiao.pdf'
}
},
methods:{

View File

@ -130,7 +130,7 @@ if (typeof window !== 'undefined') {
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=template&id=405eb28e&scoped=true&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=template&id=405eb28e&scoped=true&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"vue-office-docx",staticClass:"vue-office-docx"})
}
var staticRenderFns = []
@ -169,7 +169,7 @@ function docx_render(data, container){
getData,
render: docx_render
});
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=script&lang=js&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=script&lang=js&
@ -215,7 +215,7 @@ function docx_render(data, container){
;// CONCATENATED MODULE: ./packages/docx/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/runtime/componentNormalizer.js
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).

File diff suppressed because one or more lines are too long

View File

@ -140,7 +140,7 @@ if (typeof window !== 'undefined') {
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=template&id=405eb28e&scoped=true&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=template&id=405eb28e&scoped=true&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"vue-office-docx",staticClass:"vue-office-docx"})
}
var staticRenderFns = []
@ -179,7 +179,7 @@ function docx_render(data, container){
getData,
render: docx_render
});
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=script&lang=js&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/docx/src/main.vue?vue&type=script&lang=js&
@ -225,7 +225,7 @@ function docx_render(data, container){
;// CONCATENATED MODULE: ./packages/docx/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/runtime/componentNormalizer.js
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -74,7 +74,7 @@ if (typeof window !== 'undefined') {
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=4b4de15c&scoped=true&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=0a3921b7&scoped=true&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"vue-office-pdf",staticClass:"vue-office-pdf"},[(_vm.numPages)?_c('div',{staticClass:"vue-office-pdf-wrapper",staticStyle:{"background":"gray","padding":"30px 0","position":"relative"}},_vm._l((_vm.numPages),function(page){return _c('canvas',{key:page,ref:'canvas'+ page,refInFor:true})}),0):_vm._e()])
}
var staticRenderFns = []
@ -98,7 +98,7 @@ const pdfjsLib = 'IWZ1bmN0aW9uIHdlYnBhY2tVbml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uKHQsZS
document.body.append(script)
}))
}
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
@ -112,6 +112,10 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
props: {
src: {
type: [String]
},
staticFileUrl:{
type: String,
default: 'https://unpkg.com/pdfjs-dist@3.1.81/'
}
},
data() {
@ -147,7 +151,12 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
this.numPages = 0
return
}
const loadingTask = window.pdfjsLib.getDocument(this.src);
const loadingTask = window.pdfjsLib.getDocument({
url: this.src,
cMapUrl: `${this.staticFileUrl.endsWith('/') ? this.staticFileUrl : this.staticFileUrl + '/'}cmaps/`,
cMapPacked: true,
// enableXfa: ENABLE_XFA,
});
loadingTask.promise.then((pdfDocument) => {
this.document = pdfDocument;
this.numPages = pdfDocument.numPages;
@ -186,7 +195,7 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
;// CONCATENATED MODULE: ./packages/pdf/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/runtime/componentNormalizer.js
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
@ -298,7 +307,7 @@ var component = normalizeComponent(
staticRenderFns,
false,
null,
"4b4de15c",
"0a3921b7",
null
)

View File

@ -64,7 +64,7 @@ if (typeof window !== 'undefined') {
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=4b4de15c&scoped=true&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=0a3921b7&scoped=true&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"vue-office-pdf",staticClass:"vue-office-pdf"},[(_vm.numPages)?_c('div',{staticClass:"vue-office-pdf-wrapper",staticStyle:{"background":"gray","padding":"30px 0","position":"relative"}},_vm._l((_vm.numPages),function(page){return _c('canvas',{key:page,ref:'canvas'+ page,refInFor:true})}),0):_vm._e()])
}
var staticRenderFns = []
@ -88,7 +88,7 @@ const pdfjsLib = 'IWZ1bmN0aW9uIHdlYnBhY2tVbml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uKHQsZS
document.body.append(script)
}))
}
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
@ -102,6 +102,10 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
props: {
src: {
type: [String]
},
staticFileUrl:{
type: String,
default: 'https://unpkg.com/pdfjs-dist@3.1.81/'
}
},
data() {
@ -137,7 +141,12 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
this.numPages = 0
return
}
const loadingTask = window.pdfjsLib.getDocument(this.src);
const loadingTask = window.pdfjsLib.getDocument({
url: this.src,
cMapUrl: `${this.staticFileUrl.endsWith('/') ? this.staticFileUrl : this.staticFileUrl + '/'}cmaps/`,
cMapPacked: true,
// enableXfa: ENABLE_XFA,
});
loadingTask.promise.then((pdfDocument) => {
this.document = pdfDocument;
this.numPages = pdfDocument.numPages;
@ -176,7 +185,7 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
;// CONCATENATED MODULE: ./packages/pdf/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/runtime/componentNormalizer.js
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
@ -288,7 +297,7 @@ var component = normalizeComponent(
staticRenderFns,
false,
null,
"4b4de15c",
"0a3921b7",
null
)

File diff suppressed because one or more lines are too long

View File

@ -74,7 +74,7 @@ if (typeof window !== 'undefined') {
// Indicate to webpack that this file can be concatenated
/* harmony default export */ var setPublicPath = (null);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=4b4de15c&scoped=true&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=template&id=0a3921b7&scoped=true&
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{ref:"vue-office-pdf",staticClass:"vue-office-pdf"},[(_vm.numPages)?_c('div',{staticClass:"vue-office-pdf-wrapper",staticStyle:{"background":"gray","padding":"30px 0","position":"relative"}},_vm._l((_vm.numPages),function(page){return _c('canvas',{key:page,ref:'canvas'+ page,refInFor:true})}),0):_vm._e()])
}
var staticRenderFns = []
@ -98,7 +98,7 @@ const pdfjsLib = 'IWZ1bmN0aW9uIHdlYnBhY2tVbml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uKHQsZS
document.body.append(script)
}))
}
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/index.js??vue-loader-options!./packages/pdf/src/main.vue?vue&type=script&lang=js&
@ -112,6 +112,10 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
props: {
src: {
type: [String]
},
staticFileUrl:{
type: String,
default: 'https://unpkg.com/pdfjs-dist@3.1.81/'
}
},
data() {
@ -147,7 +151,12 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
this.numPages = 0
return
}
const loadingTask = window.pdfjsLib.getDocument(this.src);
const loadingTask = window.pdfjsLib.getDocument({
url: this.src,
cMapUrl: `${this.staticFileUrl.endsWith('/') ? this.staticFileUrl : this.staticFileUrl + '/'}cmaps/`,
cMapPacked: true,
// enableXfa: ENABLE_XFA,
});
loadingTask.promise.then((pdfDocument) => {
this.document = pdfDocument;
this.numPages = pdfDocument.numPages;
@ -186,7 +195,7 @@ const PdfJsWorkerSrc = `data:text/javascript;base64,${worker}`;
;// CONCATENATED MODULE: ./packages/pdf/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.0@vue-loader/lib/runtime/componentNormalizer.js
;// CONCATENATED MODULE: ./node_modules/_vue-loader@15.10.1@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
@ -298,7 +307,7 @@ var component = normalizeComponent(
staticRenderFns,
false,
null,
"4b4de15c",
"0a3921b7",
null
)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

BIN
lib/static/cmaps/78-H.bcmap Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/static/cmaps/78-V.bcmap Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/static/cmaps/B5-H.bcmap Normal file

Binary file not shown.

BIN
lib/static/cmaps/B5-V.bcmap Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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>"Rd<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
lib/static/cmaps/GB-V.bcmap Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More