File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @libresign/vue-pdf-editor" ,
3
3
"description" : " vue2 pdf editor component" ,
4
- "version" : " 1.2.5 " ,
4
+ "version" : " 1.2.6 " ,
5
5
"author" : " LibreCode" ,
6
6
"private" : false ,
7
7
"main" : " dist/vue-pdf-editor.umd.js" ,
Original file line number Diff line number Diff line change @@ -379,12 +379,6 @@ export default {
379
379
fetchFont (this .currentFont )
380
380
this .narrowEnlargeShow = true
381
381
this .initTextField ()
382
- await this .initImages ()
383
- this .$emit (' pdf-editor:end-init' , {
384
- allObjects: this .allObjects ,
385
- numPages: this .numPages ,
386
- pages: this .pages ,
387
- })
388
382
} catch (e) {
389
383
console .log (e)
390
384
}
@@ -508,6 +502,23 @@ export default {
508
502
.map ((_ , i ) => this .pdfDocument .getPage (i + 1 ))
509
503
this .allObjects = this .pages .map (() => [])
510
504
this .pagesScale = Array (this .numPages ).fill (1 )
505
+
506
+ const data = {
507
+ allObjects: this .allObjects ,
508
+ numPages: this .numPages ,
509
+ pages: this .pages ,
510
+ measurement: [],
511
+ }
512
+ // Wait until all pages have been read
513
+ const pages = await Promise .all (this .pages );
514
+ pages .forEach ((page ) => {
515
+ const measurement = page .getViewport ().viewBox
516
+ data .measurement [page .pageNumber ] = {
517
+ width: measurement[2 ],
518
+ height: measurement[3 ],
519
+ }
520
+ })
521
+ this .$emit (' pdf-editor:end-init' , data)
511
522
}
512
523
} catch (e) {
513
524
console .log (' Failed to add pdf.' )
You can’t perform that action at this time.
0 commit comments