I am unable to rotate image from center or any fixed point by using itext pdf library in java program.When i rotate image it's x and y cordinate gets changed. Kindly help me in this regard.
Image pdfImage=Image.getInstance("assets/product.png");
pdfImage.setAlignment(Element.ALIGN_CENTER);
pdfImage.setRotationDegrees(30);
document.add(pdfImage);
pdfImage.setRotationDegrees(140);
document.add(pdfImage);
In above code there is no same point by which I can judge the rotation point.
Thanks in advance
解决方案
When you set a rotation using the setRotationDegrees() method, the image is rotated using the lower-left corner of the image as its rotation point. If you want another rotation point, you'll need to work with low-level functionality to change the CTM. See the different addImage() methods in the PdfCon