File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -1491,15 +1491,14 @@ class PDFViewer {
1491
1491
height = 0 ,
1492
1492
widthScale ,
1493
1493
heightScale ;
1494
- const changeOrientation = pageView . rotation % 180 !== 0 ;
1495
- const pageWidth =
1496
- ( changeOrientation ? pageView . height : pageView . width ) /
1497
- pageView . scale /
1498
- PixelsPerInch . PDF_TO_CSS_UNITS ;
1499
- const pageHeight =
1500
- ( changeOrientation ? pageView . width : pageView . height ) /
1501
- pageView . scale /
1502
- PixelsPerInch . PDF_TO_CSS_UNITS ;
1494
+ // Utilize the viewport "end-points" rather than the effective width/height
1495
+ // to avoid problems in PDF documents where the viewport starts at non-zero
1496
+ // coordinates (fixes bug 1913617).
1497
+ // NOTE: In the majority of PDF documents, those values agree anyway.
1498
+ const { viewBox } = pageView . viewport ;
1499
+ const changeOrientation = pageView . rotation % 180 !== 0 ,
1500
+ pageWidth = changeOrientation ? viewBox [ 3 ] : viewBox [ 2 ] ,
1501
+ pageHeight = changeOrientation ? viewBox [ 2 ] : viewBox [ 3 ] ;
1503
1502
let scale = 0 ;
1504
1503
switch ( destArray [ 1 ] . name ) {
1505
1504
case "XYZ" :
You can’t perform that action at this time.
0 commit comments