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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to rotate a single line of text in my pdf?

Thread ID:





108635 May 3,2013 03:05 PM UTC Aug 28,2014 07:27 AM UTC ASP.NET Web Forms (Classic) 4
Tags: PDF
Gert Van Meerbergen
Asked On May 3, 2013 03:05 PM UTC

I'm currently trying to rotate a single line of text in my pdf. This is proving harder than expected.
Using .Graphics.TransformRotate(45) on the PdfPage isn't really an option since I'm using it in a for loop.

Here's an example of what I'm trying to do:

For Each value As values
Dim originalState As PdfGraphicsState = currentPage.Graphics.Save()

Now this requires some complex logic for the x and y values in the DrawString, so I'm hoping I can somehow only rotate the string I'm drawing there. If needed I can always store it in a PdfTextElement. But even on the element I haven't found a way to fix this.

KarthikeyanC [Syncfusion]
Replied On May 8, 2013 05:37 AM UTC

Hi Gert,

Thank you for your interest in Syncfusion Products.


While using RotateTransform, it will transform the whole coordinate system to the angle mentioned.

So the default coordinates will change accordingly.

Using some mathematical calculations I have tried calculating the new coordinates.

   Dim xNew As Double = x * Math.Cos(angle) - y * Math.Sin(angle)

   Dim yNew As Double = x * Math.Sin(angle) + y * Math.Cos(angle)


I also attached a sample for your reference.


Please let us know if you have any concern.






Gert Van Meerbergen
Replied On May 8, 2013 08:22 AM UTC

Hi Karthikeyan

Unfortunately your solution does not work for me. I have added a zip with 2 images: what we want to achieve (wanted.png) and what we currently have (current.png).

As you can see on the image, we want to have a rotated text (45 degrees) with a different x-axis value and aligned on the y-axis.


KarthikeyanC [Syncfusion]
Replied On May 13, 2013 04:22 AM UTC

Hi Gert,

Thank you for your update.


I have modified the sample according to your new image attached.

Please refer the sample, you may adjust the values to get the text in the proper destination in your document.



Please let us know if you have any concern.





Luca Cavicchioli
Replied On August 28, 2014 07:27 AM UTC

I'm also interested in the answer and I'd like to take a look at the saples proposed but when I'm trying to download them I always receive the error message:

<Message>Access Denied</Message>

Please fix the problem I'm also trying to print rotated string but what I'm getting is an empty PDF.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon