@@ -292,17 +292,13 @@ export default {
292292 type: Boolean ,
293293 default: false ,
294294 },
295- initFileSrc: {
296- type: String ,
297- default: ' ' ,
298- },
299- initFile: {
300- type: [File , Blob , ArrayBuffer ],
301- default: null ,
295+ initFiles: {
296+ type: Array ,
297+ default : () => [],
302298 },
303- initFileName : {
304- type: String ,
305- default: ' ' ,
299+ initFileNames : {
300+ type: Array ,
301+ default : () => [] ,
306302 },
307303 initTextFields: {
308304 type: Array ,
@@ -415,13 +411,16 @@ export default {
415411 this .scale = parseFloat ((this .scale - 0.1 ).toFixed (1 ))
416412 },
417413 async init () {
418- const file = this .initFile || this .initFileSrc
419- if (! file) {
420- console .log (' init file is not exist' )
414+ if (this .initFiles .length === 0 ) {
415+ console .log (' init files do not exist' )
421416 return
422417 }
418+
423419 try {
424- await this .addPDF (file)
420+ for (let i = 0 ; i < this .initFiles .length ; i++ ) {
421+ const fileName = this .initFileNames [i] || ' '
422+ await this .addPDF (this .initFiles [i], fileName)
423+ }
425424 this .selectedDocIndex = 0
426425 this .selectedPageIndex = 0
427426 fetchFont (this .currentFont )
@@ -609,7 +608,7 @@ export default {
609608 this .pdfDocuments = []
610609 this .selectedDocIndex = - 1
611610 },
612- async addPDF (file ) {
611+ async addPDF (file , fileName = ' ' ) {
613612 try {
614613 // Don't reset if we're adding to existing documents
615614 if (this .pdfDocuments .length === 0 ) {
@@ -618,8 +617,8 @@ export default {
618617
619618 const originalFile = file
620619 let pdfName = ' '
621- if (this . initFileName && this . pdfDocuments . length === 0 ) {
622- pdfName = this . initFileName
620+ if (fileName ) {
621+ pdfName = fileName
623622 } else if (file instanceof File && file .name ) {
624623 pdfName = file .name
625624 } else {
0 commit comments