ComponentOne PDF for .NET
C1.C1Pdf Namespace / C1PdfDocument Class / DrawStringRtf Method / DrawStringRtf(String,Font,Brush,RectangleF) Method
RTF string to draw.
System.Drawing.Font object that defines the appearance and size of the drawn text.
System.Drawing.Brush object that defines the color of the drawn text.
System.Drawing.RectangleF structure that specifies the location of the drawn text, in points from the top left corner of the page.

In This Topic
    DrawStringRtf(String,Font,Brush,RectangleF) Method
    In This Topic
    Draws an RTF string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.
    Syntax
    'Declaration
     
    
    Public Overloads Function DrawStringRtf( _
       ByVal text As String, _
       ByVal font As Font, _
       ByVal brush As Brush, _
       ByVal rc As RectangleF _
    ) As Integer
    public int DrawStringRtf( 
       string text,
       Font font,
       Brush brush,
       RectangleF rc
    )

    Parameters

    text
    RTF string to draw.
    font
    System.Drawing.Font object that defines the appearance and size of the drawn text.
    brush
    System.Drawing.Brush object that defines the color of the drawn text.
    rc
    System.Drawing.RectangleF structure that specifies the location of the drawn text, in points from the top left corner of the page.

    Return Value

    The index of first character that was not printed because it did not fit in the specified rectangle, or the value of int.MaxValue if the entire string was rendered.
    Remarks

    This method is similar to MeasureString(String,Font,Single), except it recognizes Rtf (Rich Text Format) strings like those used in the System.Windows.Forms.RichTextBox control.

    There are two types of RTF strings:

    1) Complete RTF strings contain an Rtf header that specifies the fonts and colors used within the string. These strings can be obtained from a System.Windows.Forms.RichTextBox control using the System.Windows.Forms.RichTextBox.Rtf property, or from Rtf files saved to disk. In this case, the font and brush parameters are not used.

    2) Partial RTF strings contain embedded Rtf tags but no Rtf header. These strings are easy to build in code and can be used to render text with special attributes such as bold and italics (for example: "this text contains {\b BOLD} and {\i ITALICS}". In this case, the font and brush parameters are used to build the Rtf header automatically.

    The DrawStringRtf method returns the index of the first character that was not printed because it did not fit the output rectangle. You can use this value to make text flow from page to page, or from one frame to another within a page. To do this, use the overload that takes the starting character in the text as a parameter.

    See Also