File tree Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Expand file tree Collapse file tree 4 files changed +9
-17
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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" ,
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" ,
Original file line number Diff line number Diff line change @@ -197,20 +197,13 @@ import ImageItem from './Components/Image.vue'
197197import TextItem from ' ./Components/TextItem.vue'
198198import Drawing from ' ./Components/Drawing.vue'
199199import 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'
205201import { save } from ' ./utils/PDF.js'
206202import ImageIcon from ' vue-material-design-icons/Image.vue'
207203import TextIcon from ' vue-material-design-icons/Text.vue'
208204import GestureIcon from ' vue-material-design-icons/Gesture.vue'
209205import 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-
214207export 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 ()
Original file line number Diff line number Diff line change 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 */
5254export async function readAsPDF ( file ) {
53- return pdfjsLib . getDocument ( file ) . promise
55+ return getDocument ( file ) . promise
5456}
You can’t perform that action at this time.
0 commit comments