Skip to content

Commit e56f6b3

Browse files
authored
Merge pull request #106 from LibreSign/chore/change-setup-of-worker-src
chore: change setup of workerSrc
2 parents b6f6f15 + 42144e1 commit e56f6b3

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ https://www.npmjs.com/package/@libresign/vue-pdf-editor
4141
:init-image-scale = "0.2" <!--The zoom level of the initialized picture defaults to 0.2 times the original size-->
4242
:seal-image-show="true" <!--Whether to show the signed example of the default FALSE-->
4343
:seal-image-hidden-on-save="true" <!--Whether the signed example is hidden by the default FALSE when saving-->
44-
:worker-src=null <!-- URL of pdf.worker -->
4544
@onSave2Upload="【save callback】" <!--Save the callback load: PDFBYTES and FILENAME-->
4645
/>
4746
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@libresign/vue-pdf-editor",
33
"description": "vue2 pdf editor component",
4-
"version": "1.3.5",
4+
"version": "1.3.6",
55
"author": "LibreCode",
66
"private": false,
77
"main": "dist/vue-pdf-editor.umd.js",

src/VuePdfEditor.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ import ImageItem from './Components/Image.vue'
197197
import TextItem from './Components/TextItem.vue'
198198
import Drawing from './Components/Drawing.vue'
199199
import DrawingCanvas from './Components/DrawingCanvas.vue'
200-
import { configurePDFWorkerSrc, readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js'
200+
import { readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js'
201201
import { save } from './utils/PDF.js'
202202
import ImageIcon from 'vue-material-design-icons/Image.vue'
203203
import TextIcon from 'vue-material-design-icons/Text.vue'
@@ -311,10 +311,6 @@ export default {
311311
type: Boolean,
312312
default: false,
313313
},
314-
workerSrc: {
315-
type: String,
316-
default: null
317-
},
318314
},
319315
data() {
320316
return {
@@ -497,9 +493,6 @@ export default {
497493
file = await blob.arrayBuffer();
498494
}
499495
500-
if (this.workerSrc) {
501-
configurePDFWorkerSrc(this.workerSrc)
502-
}
503496
this.pdfDocument = await readAsPDF(file)
504497
if (this.pdfDocument) {
505498
this.numPages = this.pdfDocument.numPages

src/utils/asyncReader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist'
22
import pdfWorkerCode from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs'
33

4-
export function configurePDFWorkerSrc(customWorkerSrc) {
5-
GlobalWorkerOptions.workerSrc = customWorkerSrc || pdfWorkerCode
4+
if (!GlobalWorkerOptions.workerSrc) {
5+
GlobalWorkerOptions.workerSrc = pdfWorkerCode
66
}
77

88
/**

0 commit comments

Comments
 (0)