90
90
class =" w-full" >
91
91
<div v-if =" showRename" class =" flex justify-center px-5 pt-5 w-full md:hidden" >
92
92
<div class =" flex items-center" >
93
- <img src = " assets/img/edit.svg "
94
- class =" mr-2 justify-center "
95
- alt =" a pen, edit pdf name"
96
- @click =" renamePDF($refs.renamePDFInputTwo) " >
93
+ <PencilIcon :size = " 20 "
94
+ class =" mr-2"
95
+ title =" a pen, edit pdf name"
96
+ @click =" renamePDF($refs.renamePDFInputOne) " / >
97
97
<input ref =" renamePDFInputTwo"
98
98
v-model =" pdfName"
99
99
style =" text-align :center "
190
190
</template >
191
191
192
192
<script >
193
- import ' pdfjs-dist/web/pdf_viewer.css'
194
-
195
193
import { fetchFont } from ' ./utils/prepareAssets.js'
196
194
197
195
import PDFPage from ' ./Components/PDFPage.vue'
@@ -210,8 +208,8 @@ import TextIcon from 'vue-material-design-icons/Text.vue'
210
208
import GestureIcon from ' vue-material-design-icons/Gesture.vue'
211
209
import PencilIcon from ' vue-material-design-icons/Pencil.vue'
212
210
213
- const PDFJS = require ( ' pdfjs-dist' )
214
- PDFJS .GlobalWorkerOptions .workerSrc = require (' pdfjs-dist/build/pdf.worker' )
211
+ import * as pdfjsLib from ' pdfjs-dist'
212
+ pdfjsLib .GlobalWorkerOptions .workerSrc = require (' pdfjs-dist/build/pdf.worker' )
215
213
216
214
export default {
217
215
name: ' VuePdfEditor' ,
@@ -494,7 +492,7 @@ export default {
494
492
async getPdfDocument (file ) {
495
493
const blob = new Blob ([file])
496
494
const url = window .URL .createObjectURL (blob)
497
- return PDFJS .getDocument (url).promise
495
+ return pdfjsLib .getDocument (url).promise
498
496
},
499
497
async addPDF (file ) {
500
498
try {
@@ -671,7 +669,7 @@ export default {
671
669
if (this .sealImageShow ) {
672
670
for (let i = 0 ; i < this .pages .length ; i++ ) {
673
671
const seal = this .allObjects [i].find ((e ) => e .isSealImage === true )
674
- const page = this .pages [i]
672
+ const page = await this .pages [i]. then ( response => response);
675
673
sealInfo .push ({
676
674
page: page ._pageIndex ,
677
675
pageWidth: page ._pageInfo .view [2 ],
0 commit comments