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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to rotate text?

Thread ID:

Created:

Updated:

Platform:

Replies:

117878 Jan 3,2015 07:23 PM UTC Jan 6,2015 03:46 AM UTC Xamarin.Forms 1
loading
Tags: PDF
Michael
Asked On January 3, 2015 07:23 PM UTC

Hi,

I tried without success to rotate some text in a PDF on Android platform. I didn’t tested it on other platforms. Here is my code:

 

      void TestPDF(object sender, EventArgs e)
      {
         PdfFont bigFont = new PdfStandardFont(PdfFontFamily.Helvetica, 30f);

         PdfDocument document = new PdfDocument();

         PdfPage page = document.Pages.Add();

         page.Graphics.DrawString("Straight", bigFont, PdfBrushes.Black, new Syncfusion.Drawing.PointF(10, 10));

         DrawRotatedText("Rotated", bigFont, new PointF(50, 200), 180, page);

         page.Graphics.DrawString("Already Straight", bigFont, PdfBrushes.Black, new Syncfusion.Drawing.PointF(10, 300));

         //Saves the document.
         MemoryStream stream = new MemoryStream();
         document.Save(stream);
         document.Close(true);
         Xamarin.Forms.DependencyService.Get<ISave>().Save("verticalText.pdf", stream, true);
      }

       private void DrawRotatedText(String text, PdfFont font, PointF position, float angle, PdfPage page)
      {
         //save the current graphics states
         PdfGraphicsState state = page.Graphics.Save();

         //Translate the coordinate system’s to where you want draw the text position
         page.Graphics.TranslateTransform((float)position.X, (float)position.Y);

         //Rotate the coordinate system’s
         page.Graphics.RotateTransform(angle);

         //Draw the string at the origin
         page.Graphics.DrawString(text, font, PdfBrushes.DarkBlue, new Syncfusion.Drawing.PointF(0, 0));

         //Restore the graphics state
         page.Graphics.Restore(state);
      }

Does anybody have an idea of my error?

Thanks,

Michael


Praveenkumar H [Syncfusion]
Replied On January 6, 2015 03:46 AM UTC

Hi Michael,

Thank you for using syncfusion products,

Currently we don’t have the implementation for rotate transform in xamarin platforms, we have already logged the feature request in our database, and we will let you know once the feature has been implemented.

Please let us know if you need further assistance.

With Regards,

Praveen



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.

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

;