GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfTextContent Class

    Namespace:
    GemBox.Pdf.Content
    Assembly:
    GemBox.Pdf.dll

    Represents a textual PDF content (a sequence of glyphs from a single face of a single font).

    • C#
    • VB.NET
    public sealed class PdfTextContent : PdfVisualContentElement
    Public NotInheritable Class PdfTextContent
        Inherits PdfVisualContentElement
    Inheritance:
    System.Object
    PdfContentElement
    PdfVisualContentElement
    PdfTextContent

    Properties

    Bounds

    Gets the bounds of the PdfTextContent.

    • C#
    • VB.NET
    public override PdfQuad Bounds { get; }
    Public Overrides ReadOnly Property Bounds As PdfQuad
    Property Value
    PdfQuad

    The bounds of the PdfTextContent.

    Overrides
    PdfVisualContentElement.Bounds
    Remarks

    This member, although exposed as a property for easier debugging, performs complex calculations, so instead of accessing it frequently, cache its result instead.

    ElementType

    Gets the Text value.

    • C#
    • VB.NET
    public override PdfContentElementType ElementType { get; }
    Public Overrides ReadOnly Property ElementType As PdfContentElementType
    Property Value
    PdfContentElementType

    The Text value.

    Overrides
    PdfContentElement.ElementType

    EncodedText

    Gets or sets the sequence of character codes, with optionally individually positioned glyphs, that represent a PdfBasicFont-encoded text contained in this PdfTextContent element.

    warning

    When setting a PdfEncodedContentString value, note that the current font (retrieved with PdfTextContent.Format.Text.GetFont(out Double) method) might not contain all the necessary information to correctly position, render and/or convert to Unicode all characters of the new PdfEncodedContentString value so set it at your own risk.

    • C#
    • VB.NET
    public PdfEncodedContentString EncodedText { get; set; }
    Public Property EncodedText As PdfEncodedContentString
    Property Value
    PdfEncodedContentString

    The sequence of character codes, with optionally individually positioned glyphs, that represent a PdfBasicFont-encoded text contained in this PdfTextContent element.

    Exceptions
    System.ArgumentException

    Value is empty.

    Location

    Gets the baseline origin location of the PdfTextContent.

    • C#
    • VB.NET
    public PdfPoint Location { get; }
    Public ReadOnly Property Location As PdfPoint
    Property Value
    PdfPoint

    The baseline origin location of the PdfTextContent.

    Remarks

    This property is a shorthand for offset of the TextRenderingTransform matrix.

    Text

    Gets the sequence of glyphs (PdfContentChars) contained in this PdfTextContent element.

    • C#
    • VB.NET
    public PdfContentString Text { get; }
    Public ReadOnly Property Text As PdfContentString
    Property Value
    PdfContentString

    The sequence of glyphs (PdfContentChars) contained in this PdfTextContent element.

    Remarks

    The returned PdfContentString is valid as long as the information on which it depends is not modified on this PdfTextContent element. The information on which it depends is: EncodedText, TextTransform and Text-related Format members GetFont(out Double), HorizontalScaling, Rise, CharacterSpacing and WordSpacing.

    TextRenderingTransform

    Gets the transformation from text space to device space of the parent PdfContentGroup.

    To get the transformation from text space to device space of the page, append Transform matrices of all ancestor PdfContentGroups to TextRenderingTransform matrix.

    • C#
    • VB.NET
    public PdfMatrix TextRenderingTransform { get; }
    Public ReadOnly Property TextRenderingTransform As PdfMatrix
    Property Value
    PdfMatrix

    The transformation from text space to device space of the parent PdfContentGroup.

    Remarks

    TextRenderingTransform is a temporary matrix; conceptually, it is recomputed before each glyph is painted during a text-showing operation.

    TextTransform

    Gets or sets the transformation from text space to user space.

    Text space is the coordinate system in which text is shown. Specifically, the origin of the first glyph shown by a text-showing operator is placed at the origin of text space. If text space has been translated, scaled, or rotated, then the position, size, or orientation of the glyph in user space is correspondingly altered.

    • C#
    • VB.NET
    public PdfMatrix TextTransform { get; set; }
    Public Property TextTransform As PdfMatrix
    Property Value
    PdfMatrix

    The transformation from text space to user space.

    See Also
    PDF Specification ISO 32000-1:2008, section '9.4.4 Text Space Details'

    Methods

    Split()

    Splits the current PdfTextContent if it is shown in the underlying content stream using the TJ operator and if any position adjustment in the TJ array is such that it introduces a considerable spacing between the surrounding characters.

    • C#
    • VB.NET
    public int Split()
    Public Function Split As Integer
    Returns
    System.Int32

    The number of PdfTextContents into which the current PdfTextContent is split. If zero is returned, then the current PdfTextContent is not split.

    ToString()

    Returns a Unicode text contained in this PdfTextContent.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A Unicode text contained in this PdfTextContent.

    Overrides
    System.Object.ToString()

    Inherited Properties

    Collection

    Gets the PdfContentElementCollection that the PdfContentElement belongs to.

    (Inherited from PdfContentElement)

    Format

    Gets or sets the formatting properties applied to the PdfVisualContentElement.

    (Inherited from PdfVisualContentElement)

    Next

    Gets the next PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Previous

    Gets the previous PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Transform

    Gets or sets the transformation from the new (transformed) coordinate system to the original (untransformed) coordinate system.

    All coordinates used after the transformation are expressed in the transformed coordinate system.

    tip

    Before setting the Transform, move PdfVisualContentElement into its own PdfContentGroup so that the transformation is confined to that PdfContentGroup and doesn't have any effect on PdfContentElements outside that PdfContentGroup.

    (Inherited from PdfVisualContentElement)

    Examples

    Reading text info example

    See Also

    PDF Specification ISO 32000-1:2008, section '9.4 Text Objects'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.