We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Rotating text for PDF printing

Thread ID:

Created:

Updated:

Platform:

Replies:

116392 May 17,2014 08:37 PM May 28,2014 02:44 AM ASP.NET Web Forms (Classic) 3
loading
Tags: PDF
Ljubomir Bacovic
Asked On May 17, 2014 08:37 PM

Hello,

I have some strings that need to be printed vertically. I saw it could be done with RotateTransform method of PdfGraphics, but I don't know how. I tried to change the coords with trigonometrical functions, but I must be doing something wrong, since I get empty pdf as a result every time.

Could you please guide me in this, and if possible give a small example that I can learn from?

Thanks,
Ljubomir



KarthikeyanC [Syncfusion]
Replied On May 21, 2014 09:23 AM

Hi Ljubomir,

Thank you for your interest in Syncfusion Products.

 

Yes, we can able to print the text vertically using RotateTransform, please use the below code snippet.

            page.Graphics.RotateTransform(-90);

            page.Graphics.DrawString("Syncfusion", font, PdfBrushes.Black, new PointF(-150, 150));

 

Below is the Online sample link for stamping the text with inclined.

http://asp.syncfusion.com/demos/reporting/Pdf/Modify%20Documents/Import%20and%20Stamp/CS/default.aspx

 

Please let us know if you need further assistance.

Thanks,

Karthikeyan.C


Eric Eckberg
Replied On May 26, 2014 02:06 PM

I have seen a few answers like this related to 90 and 45 degree text, but how are the coordinates changes if I'm rotating text 180 degrees?  The Application I am currently developing involves printing a desk stand by folding a letter size sheet in half.  The top half would have the person's name upside down, and the bottom half right side up.  When folded, both sides display right side up.  

I am using RotateTransform(180) after having placed the rightside up content, but the string I draw after the RotateTransform does not display on the generated PDF at all.  How are the coordinates changed?

For instance, your example prints the string Hello World as:

g.DrawString("Hello World", font, brush, new PointF(20, 20));

How can I draw Hello World upside down in the same location instead?


Thanks,
Eric


KarthikeyanC [Syncfusion]
Replied On May 28, 2014 02:44 AM

Hi Eric,

Thank you for your update.

 

Please find the coordinate system after applying RotateTransform below.

 

Rotate Transformation

Coordinate System

Code Snippet

RotateTransform(0)

X= 150; Y=150

            page.Graphics.RotateTransform(0);

            page.Graphics.DrawString("Syncfusion", font, PdfBrushes.Black, new PointF(150, 150));

 

RotateTransform(-90)

X= -150; Y=150

            page.Graphics.RotateTransform(-90);

            page.Graphics.DrawString("Syncfusion", font, PdfBrushes.Black, new PointF(-150, 150));

 

RotateTransform(90)

X= 150; Y= -150

            page.Graphics.RotateTransform(90);

            page.Graphics.DrawString("Syncfusion", font, PdfBrushes.Black, new PointF(150, -150));

 

RotateTransform(180)

X= -150; Y= -150

            page.Graphics.RotateTransform(180);

            page.Graphics.DrawString("Syncfusion", font, PdfBrushes.Black, new PointF(-150, -150));

 

 

Please let us know if you need any further assistance.

Thanks,

Karthikeyan.C


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;