How to rotate text and images in a rotated PDF?

1.6k Views Asked by At

I am editing PDFs using PDFsharp (editing in the sense of adding images, text etc.), and that works perfectly well.

gfx.DrawImage(img, pointX, pointY, width, height);
gfx.DrawString(text, thumbFont, XBrushes.Black, 
        new XRect(pointX + 10, pointY + height + 2, width - 10, 5), XStringFormats.TopLeft);

But when I am trying to edit a PDF which has Rotate property as 270, the added text, images are coming horizontally.

The actual problem that I am facing is, the PDF is not actually rotated, it just changes the Page.Rotate property, so my question is how to add text and image at the correct co-ordinate and in correct orientation to have rotation of 270.

1

There are 1 best solutions below

0
On

The rotation is applied to the page at display time. 270° clockwise are 90° counter-clockwise.

AFAIK you have to rotate the text you are adding to the PDF 270° CCW (90° CW) so the text shows normally on the rotated PDF page.