How do I rotate images in PDF?

Q: Can you show me an example of how to rotate a rectanglar shapes
image at an odd angle (like 35, 45, 60, 70, etc.)? Your examples end
up rendering a badly skewed image. When the width and height are the
same, it seems to render fine, but for an image shaped like 135x35
pixels, it renders incorrectly.

A: Probably the simplest approach to add a rotated image is using
‘pdftron.PDF.Stamper’ (as shown in Stamper sample).

In case you want to add the rotated image using ElementBuilder/
ElementWriter you would need to do some matrix manipulation. For

Image img = Image.Create(doc, "my.png");
Matrix2D rot = Matrix2D.RotationMatrix(rotationDegrees * deg2rad);
Matrix2D scale = new Matrix2D(sx, 0, 0, sy, 0, 0);
Matrix2D trans = new Matrix2D(1, 0, 0, 1, x, y);
Matrix2D mtx = trans * scale * rot;
Element e = element_builder.CreateImage(img, mtx);

For more information on transformations and the use of Matrix2D please