PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Apr 19, 2024 3:46 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: RotateAtTransform
PostPosted: Fri May 01, 2015 8:29 pm 
Offline

Joined: Tue Jan 27, 2015 3:02 pm
Posts: 6
Hi,

Please help me understand the coordinates with RotateAtTransformation. I have a text area on a page. A user can place text in the box and they can rotate it.

This would be my un-rotated text are top corner.
_________
|(0,0).....|
|............|
|............|
------------

So the user can always use a coordinate system that is from the top left corner I'm moving my XY point to the top right of the text area using 90 rotation

_________
|......(0,0)|
|............|
|............|
_________

However the text area is moving p the page like the Y point is also being transformed.

Can somebody explain to me how the coordinates are being transformed?

Thanks,
Ron


Top
 Profile  
Reply with quote  
 Post subject: Re: RotateAtTransform
PostPosted: Sat May 02, 2015 7:28 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 915
Location: CCAA
Hi!

If you want to keep the text area at the same place, use the centre of the text area as the point for the RotateAtTransform.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: RotateAtTransform
PostPosted: Mon May 04, 2015 4:16 pm 
Offline

Joined: Tue Jan 27, 2015 3:02 pm
Posts: 6
Wouldn't that only work for centered text?


Top
 Profile  
Reply with quote  
 Post subject: Re: RotateAtTransform
PostPosted: Tue May 05, 2015 8:58 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
ronmccafferty wrote:
Wouldn't that only work for centered text?
Lay a postcard on your desktop and rotate it 90°.
Rotate it around any of the four corners, rotate it around its center.

Try a postcard with centered text and a postcard with left-aligned text. Does it work for both postcards?

If you want to rotate "in sito", rotate around the center.
If you rotate around one of the corners, the postcard will leave the area it previously occupied.

With PDF objects, the center of rotation can even be outside the object. Difficult to simulate with a postcard, but can be done.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: RotateAtTransform
PostPosted: Mon May 11, 2015 6:00 pm 
Offline

Joined: Tue Jan 27, 2015 3:02 pm
Posts: 6
Sorry Thomas, still confused.

I did the post card thing in code using code with 0, 270, 180, and 90 degree rotation. The text spun around the point as expected. I tried your suggestion of rotate around the center.

Select Case LabelItem.Rotation
Case "90"
'save off gfx state
gfx.Save()
gfx.RotateAtTransform(90, New XPoint(Xloc + (PageTemplate.LabelWidth / 2), Yloc + (PageTemplate.LabelHeight / 2)))

then later:
gfx.DrawString(CurrentText, CurrentFont, ThisBrush, New XRect(Xloc + LabelItem.Indent, Yloc + LabelItem.Baseline, PageTemplate.LabelWidth, LabelItem.FontSize), ThisStringFormat)

The text is not staying "in sito". It is now shifted to the right.

I need to print to a sheet of pre-cut labels. I know where the top left corner is. I was thinking I could just move the point to the proper "left corner" but I'm still not understanding.

Thanks,
Ron


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 255 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