PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Sat May 24, 2025 10:31 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Apr 29, 2025 5:54 pm 
Offline

Joined: Mon Apr 28, 2025 4:33 pm
Posts: 1
I am have difficulty understand what the x and y values should to rotate a rectangle minus 90 degrees (counter-clockwise rotation)
such that the original rectangle left (x) and top (y) and the position of the rotated triangles left top have the same values as originals top and left.

Assume this code as example:

XImage image = XImage.FromFile(some-filename);
XGraphics gfx = XGraphics.FromPdfPage(page);
XRect rectImg = new(50, 50, 400, 250);
XPoint xpt = new(x, y);
gfx.RotateAtTransform(-90, xpt);
gfx.DrawImage(image, rectImg);
gfx.Dispose();

such that the rotated image bounds are now 50,50,250,350

My question is what should x and y values be to achieve this?


Top
 Profile  
Reply with quote  
PostPosted: Thu May 01, 2025 3:25 pm 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1045
Location: CCAA
bhutfless wrote:
My question is what should x and y values be to achieve this?

Without testing, I assume the point should be (50, 50).
What have you tried?

See also:
https://www.pdfsharp.net/wiki/XForms-sample.ashx

Save() and Restore() are useful when working with transformations.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group