Skip to content

Commit

Permalink
Merge pull request #67 from LibreSign/feature/improvements
Browse files Browse the repository at this point in the history
Bugfixes and improvements
  • Loading branch information
vitormattos authored Jan 25, 2024
2 parents c58cd81 + ca5a158 commit 7dd2881
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: ['@babel/plugin-transform-private-methods'],
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@libresign/vue-pdf-editor",
"description": "vue2 pdf editor component",
"version": "1.2.4",
"version": "1.2.5",
"author": "LibreCode",
"private": false,
"main": "dist/vue-pdf-editor.umd.js",
Expand All @@ -22,13 +22,14 @@
"blob-stream-i2d": "^1.0.0",
"core-js": "^3.35.1",
"downloadjs": "^1.4.7",
"pdfjs-dist": "^4.0.379",
"pdfjs-dist": "^3.11.174",
"pdfkit": "^0.14.0",
"vue-material-design-icons": "^5.2.0"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-transform-private-methods": "^7.23.3",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-service": "~5.0.0",
Expand Down
14 changes: 1 addition & 13 deletions src/VuePdfEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,13 @@ import ImageItem from './Components/Image.vue'
import TextItem from './Components/TextItem.vue'
import Drawing from './Components/Drawing.vue'
import DrawingCanvas from './Components/DrawingCanvas.vue'
import {
readAsImage,
readAsPDF,
readAsDataURL,
} from './utils/asyncReader.js'
import { readAsImage, readAsPDF, readAsDataURL } from './utils/asyncReader.js'
import { save } from './utils/PDF.js'
import ImageIcon from 'vue-material-design-icons/Image.vue'
import TextIcon from 'vue-material-design-icons/Text.vue'
import GestureIcon from 'vue-material-design-icons/Gesture.vue'
import PencilIcon from 'vue-material-design-icons/Pencil.vue'
import * as pdfjsLib from 'pdfjs-dist'
pdfjsLib.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker')
export default {
name: 'VuePdfEditor',
components: {
Expand Down Expand Up @@ -489,11 +482,6 @@ export default {
this.pagesScale = []
this.allObjects = []
},
async getPdfDocument(file) {
const blob = new Blob([file])
const url = window.URL.createObjectURL(blob)
return pdfjsLib.getDocument(url).promise
},
async addPDF(file) {
try {
this.resetDefaultState()
Expand Down
6 changes: 4 additions & 2 deletions src/utils/asyncReader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as pdfjsLib from 'pdfjs-dist'
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist'
import * as pdfjsWorker from 'pdfjs-dist/build/pdf.worker'
GlobalWorkerOptions.workerSrc = pdfjsWorker

/**
*
Expand Down Expand Up @@ -50,5 +52,5 @@ export function readAsDataURL(file) {
* @param file
*/
export async function readAsPDF(file) {
return pdfjsLib.getDocument(file).promise
return getDocument(file).promise
}

0 comments on commit 7dd2881

Please sign in to comment.