I was wondering why I got AffineTransform objects like
which makes debugging difficult, instead of
The cause is this code line in PDFRenderer:
Solution: removing the cast produces a nice AffineTransform object:
However... this resulted in rendering bugs in several files (gs-bugzilla690022-reduced-rotations.pdf, gs-bugzilla690022-reduced-rotations-cropbox.pdf, PDFJS-5811-2-p4_reduced-rotations.pdf). Researching this found that getScalingFactorX() and getScalingFactorY() return negative values which they didn't before. Using Math.abs() solves this problem and now two files are slightly better (lines no longer very slightly diagonal):
PDFBOX-2376-466070.pdf page 24 and PDFBOX-4399-046615_p9_OCG-NoRotate-Annotations.pdf .