Hi,
I am struggling with rotating an image. For instance I have the following code:
AffineTransform at = new AffineTransform(rect.getWidth(), 0, 0,
rect.getHeight(), rect.getLowerLeftX(), rect.getLowerLeftY());
PDPageContentStream canvas = new PDPageContentStream(document, page,
PDPageContentStream.AppendMode.APPEND, true, true);
at.rotate(Math.toRadians(90));
canvas.drawXObject(ximage, at);
canvas.close();
It seems to work, but not the way I would've expected it to. It rotates the
image but keeps the original boxed rectangle size which in this case squishing
the image. Is this expected behavior, and if so is there way for an image to
rotate and keep the sizing? I kind of hoped it work the same way as rotating
text...
Also on a PDFBox 2.0 note, the "PDPageContentStream -> drawXObject' is
deprecated and the source says to use drawImage instead. However I was not able
to find a drawImage method that takes AffineTransform. What is the recommended
way to do this in 2.0 going forward?
Thanks,
Patrick