@@ -1790,7 +1790,7 @@ public boolean regenerateField() {
17901790 //Cast angle to [-360, 360]
17911791 double angle = pageRotation % 360 ;
17921792 //Get angle in radians
1793- angle = Math . toRadians (angle );
1793+ angle = degreeToRadians (angle );
17941794 //rotate the bounding box
17951795 Rectangle rect = bBox .toRectangle ();
17961796 //Calculate origin offset
@@ -1833,10 +1833,10 @@ public boolean regenerateField() {
18331833 //Cast angle to [-360, 360]
18341834 double angle = fieldRotation % 360 ;
18351835 //Get angle in radians
1836- angle = Math . toRadians (angle );
1836+ angle = degreeToRadians (angle );
18371837 //Calculate origin offset
1838- double translationWidth = calculateTranslationWidthAfterFieldRot (bBox .toRectangle (), Math . toRadians (pageRotation ), angle );
1839- double translationHeight = calculateTranslationHeightAfterFieldRot (bBox .toRectangle (), Math . toRadians (pageRotation ), angle );
1838+ double translationWidth = calculateTranslationWidthAfterFieldRot (bBox .toRectangle (), degreeToRadians (pageRotation ), angle );
1839+ double translationHeight = calculateTranslationHeightAfterFieldRot (bBox .toRectangle (), degreeToRadians (pageRotation ), angle );
18401840
18411841 //Concatenate rotation and translation into the matrix
18421842 Matrix currentMatrix = new Matrix (matrix .getAsNumber (0 ).floatValue (), matrix .getAsNumber (1 ).floatValue (), matrix .getAsNumber (2 ).floatValue (), matrix .getAsNumber (3 ).floatValue (), matrix .getAsNumber (4 ).floatValue (), matrix .getAsNumber (5 ).floatValue ());
@@ -3137,4 +3137,8 @@ private String optionsArrayToString(PdfArray options) {
31373137
31383138 return value ;
31393139 }
3140+
3141+ private static double degreeToRadians (double angle ) {
3142+ return Math .PI * angle / 180.0 ;
3143+ }
31403144}
0 commit comments