PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

How to rotate page by just a few degrees
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4816
Page 1 of 1

Author:  postwick [ Thu Mar 27, 2025 1:07 am ]
Post subject:  How to rotate page by just a few degrees

I'm losing my mind here. I can't be the only one who has ever wanted to do this.

I am able to calculate how much I need to rotate a page to straighten it. For example, say I need to rotate a page by -1.3 degrees. How do I do that?!

I can get as far as XGraphics.FromPdfPage and then RotateTransform that by however many degrees I want, but then how do I write that transformed XGraphics object back to the PDF page?!

Author:  TH-Soft [ Sat Mar 29, 2025 6:53 am ]
Post subject:  Re: How to rotate page by just a few degrees

postwick wrote:
How do I do that?
The transformation you set for an XGraphics object applies to anything you add afterwards to the page.

So: Create a new empty page with an XGraphics object, set the transformation, draw an existing PDF page as an image onto the new page and it will be transformed (rotated).

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/