Skip to content

Commit 7dd2881

Browse files
authored
Merge pull request #67 from LibreSign/feature/improvements
Bugfixes and improvements
2 parents c58cd81 + ca5a158 commit 7dd2881

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ module.exports = {
22
presets: [
33
'@vue/cli-plugin-babel/preset'
44
],
5+
plugins: ['@babel/plugin-transform-private-methods'],
56
}

package.json

Lines changed: 3 additions & 2 deletions
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.2.4",
4+
"version": "1.2.5",
55
"author": "LibreCode",
66
"private": false,
77
"main": "dist/vue-pdf-editor.umd.js",
@@ -22,13 +22,14 @@
2222
"blob-stream-i2d": "^1.0.0",
2323
"core-js": "^3.35.1",
2424
"downloadjs": "^1.4.7",
25-
"pdfjs-dist": "^4.0.379",
25+
"pdfjs-dist": "^3.11.174",
2626
"pdfkit": "^0.14.0",
2727
"vue-material-design-icons": "^5.2.0"
2828
},
2929
"devDependencies": {
3030
"@babel/core": "^7.23.7",
3131
"@babel/eslint-parser": "^7.23.3",
32+
"@babel/plugin-transform-private-methods": "^7.23.3",
3233
"@vue/cli-plugin-babel": "~5.0.0",
3334
"@vue/cli-plugin-eslint": "^5.0.8",
3435
"@vue/cli-service": "~5.0.0",

src/VuePdfEditor.vue

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,13 @@ 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 {
201-
readAsImage,
202-
readAsPDF,
203-
readAsDataURL,
204-
} from './utils/asyncReader.js'
200+
import { readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js'
205201
import { save } from './utils/PDF.js'
206202
import ImageIcon from 'vue-material-design-icons/Image.vue'
207203
import TextIcon from 'vue-material-design-icons/Text.vue'
208204
import GestureIcon from 'vue-material-design-icons/Gesture.vue'
209205
import PencilIcon from 'vue-material-design-icons/Pencil.vue'
210206
211-
import * as pdfjsLib from 'pdfjs-dist'
212-
pdfjsLib.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker')
213-
214207
export default {
215208
name: 'VuePdfEditor',
216209
components: {
@@ -489,11 +482,6 @@ export default {
489482
this.pagesScale = []
490483
this.allObjects = []
491484
},
492-
async getPdfDocument(file) {
493-
const blob = new Blob([file])
494-
const url = window.URL.createObjectURL(blob)
495-
return pdfjsLib.getDocument(url).promise
496-
},
497485
async addPDF(file) {
498486
try {
499487
this.resetDefaultState()

src/utils/asyncReader.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import * as pdfjsLib from 'pdfjs-dist'
1+
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist'
2+
import * as pdfjsWorker from 'pdfjs-dist/build/pdf.worker'
3+
GlobalWorkerOptions.workerSrc = pdfjsWorker
24

35
/**
46
*
@@ -50,5 +52,5 @@ export function readAsDataURL(file) {
5052
* @param file
5153
*/
5254
export async function readAsPDF(file) {
53-
return pdfjsLib.getDocument(file).promise
55+
return getDocument(file).promise
5456
}

0 commit comments

Comments
 (0)