File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
pdfbox/src/main/java/org/apache/pdfbox/rendering Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -2001,13 +2001,23 @@ PDRectangle getBBox()
20012001
20022002 Rectangle2D getBounds ()
20032003 {
2004- // apply the underlying Graphics2D device's DPI transform and y-axis flip
2005- Rectangle2D r =
2006- new Rectangle2D .Double (
2007- minX - pageSize .getLowerLeftX () * xformScalingFactorX ,
2008- (pageSize .getLowerLeftY () + pageSize .getHeight ()) * xformScalingFactorY - minY - height ,
2009- width ,
2010- height );
2004+ Rectangle2D r ;
2005+ if (flipTG )
2006+ {
2007+ // Fixes PDFBOX-5966 and PDFBOX-5251, but not pdfium 1317, which has similar PDF code.
2008+ // https://bugs.chromium.org/p/pdfium/issues/detail?id=1317
2009+ r = new Rectangle2D .Double (minX , minY , width , height );
2010+ }
2011+ else
2012+ {
2013+ // y-axis flip
2014+ r = new Rectangle2D .Double (
2015+ minX - pageSize .getLowerLeftX () * xformScalingFactorX ,
2016+ (pageSize .getLowerLeftY () + pageSize .getHeight ()) * xformScalingFactorY - minY - height ,
2017+ width ,
2018+ height );
2019+ }
2020+ // apply the underlying Graphics2D device's DPI transform
20112021 // this adjusts the rectangle to the rotated image to put the soft mask at the correct position
20122022 //TODO
20132023 // 1. change transparencyGroup.getBounds() to getOrigin(), because size isn't used in SoftMask,
You can’t perform that action at this time.
0 commit comments