Measuring Text

In many cases, you will need to check whether the string will fit on the page before you render it. You can use the C1PdfDocument.MeasureString method for that. C1PdfDocument.MeasureString returns a SizeF structure that contains the width and height of the string (in points) when rendered with a given font.

For example, the code below checks to see if a paragraph will fit on the current page and creates a page break if it has to. This will keep paragraphs together on a page:

      Visual Basic

      C#


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.