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 determine the length of an element?

Thread ID:

Created:

Updated:

Platform:

Replies:

108875 May 16,2013 07:50 PM UTC May 22,2013 04:14 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: PDF
Neelima Kaja
Asked On May 16, 2013 07:50 PM UTC

Hi, I am new user to SyncFusion. I am trying to understand how to determine where the next content should be placed. For example I have some text and use the Graphics.DrawString to write it out. then i need to put a table in after the text. My question is how do I get where the text ended so that I can use those coordinates to start my table at.
 
Thanks,
Neelima

Praveenkumar H [Syncfusion]
Replied On May 22, 2013 04:14 AM UTC

Hi Neelima,

Thank you for using Syncfusion products,

We can get the bounds of the drawn text as follow.

  PdfFont font = new PdfTrueTypeFont(new Font("arial", 12));
  PdfTextElement element = new PdfTextElement("Hi Hellow World", font);

   // Set the properties for the text element.
   element.Brush = new PdfSolidBrush(Color.Black);


   // Set the layout format properties to make the text flow through multiple pages.
   PdfLayoutFormat layoutFormat = new PdfLayoutFormat();
   layoutFormat.Break = PdfLayoutBreakType.FitPage;
   layoutFormat.Layout = PdfLayoutType.Paginate;

  // Set the bounds.
  RectangleF bounds = new RectangleF(PointF.Empty, page.Graphics.ClientSize);

   // Draw the text element.
  PdfTextLayoutResult result= element.Draw(page, bounds, layoutFormat)

 Here "result" gives the bounds of the text.

 Please follow the below link for more information about the PdfTextElement.


Please let us know if you have any concern,

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

;