iText 8.0.2 API
iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo Class Reference

Provides information and calculations needed by render listeners to display/evaluate text render operations. More...

Inheritance diagram for iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo:
iText.Kernel.Pdf.Canvas.Parser.Data.AbstractRenderInfo iText.Kernel.Pdf.Canvas.Parser.Data.IEventData

Public Member Functions

  TextRenderInfo (PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack< CanvasTag > canvasTagHierarchy)
  Creates a new TextRenderInfo object More...
 
virtual String  GetText ()
  Gets the text to be rendered according to canvas operators. More...
 
virtual PdfString  GetPdfString ()
 
Returns
original PDF string

 
virtual Matrix  GetTextMatrix ()
  Gets original Text matrix. More...
 
virtual bool  HasMcid (int mcid)
  Checks if the text belongs to a marked content sequence with a given mcid. More...
 
virtual bool  HasMcid (int mcid, bool checkTheTopmostLevelOnly)
  Checks if the text belongs to a marked content sequence with a given mcid. More...
 
virtual int  GetMcid ()
  Gets the marked-content identifier associated with this TextRenderInfo instance More...
 
virtual LineSegment  GetBaseline ()
  Gets the baseline for the text (i.e. the line that the text 'sits' on) This value includes the Rise of the draw operation - see GetRise() for the amount added by Rise More...
 
virtual LineSegment  GetUnscaledBaseline ()
 
virtual LineSegment  GetAscentLine ()
  Gets the ascent line for the text (i.e. the line that represents the topmost extent that a string of the current font could have). More...
 
virtual LineSegment  GetDescentLine ()
  Gets the descent line for the text (i.e. the line that represents the bottom most extent that a string of the current font could have). More...
 
virtual PdfFont  GetFont ()
  Getter for the font More...
 
virtual float  GetRise ()
  The rise represents how far above the nominal baseline the text should be rendered. More...
 
virtual IList< iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo GetCharacterRenderInfos ()
  Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation More...
 
virtual float  GetSingleSpaceWidth ()
 
Returns
The width, in user space units, of a single space character in the current font

 
virtual int  GetTextRenderMode ()
 
virtual Color  GetFillColor ()
 
Returns
the current fill color.

 
virtual Color  GetStrokeColor ()
 
Returns
the current stroke color.

 
virtual float  GetFontSize ()
 
virtual float  GetHorizontalScaling ()
 
virtual float  GetCharSpacing ()
 
virtual float  GetWordSpacing ()
 
virtual float  GetLeading ()
 
virtual String  GetActualText ()
  Gets /ActualText tag entry value if this text chunk is marked content. More...
 
virtual String  GetExpansionText ()
  Gets /E tag (expansion text) entry value if this text chunk is marked content. More...
 
virtual bool  IsReversedChars ()
  Determines if the text represented by this TextRenderInfo instance is written in a text showing operator wrapped by /ReversedChars marked content sequence More...
 
virtual IList< CanvasTag GetCanvasTagHierarchy ()
  Gets hierarchy of the canvas tags that wraps given text. More...
 
virtual float  GetUnscaledWidth ()
 
Returns
the unscaled (i.e. in Text space) width of the text

 
- Public Member Functions inherited from iText.Kernel.Pdf.Canvas.Parser.Data.AbstractRenderInfo
  AbstractRenderInfo (CanvasGraphicsState gs)
 
virtual CanvasGraphicsState  GetGraphicsState ()
 
virtual bool  IsGraphicsStatePreserved ()
 
virtual void  PreserveGraphicsState ()
 
virtual void  ReleaseGraphicsState ()
 

Detailed Description

Provides information and calculations needed by render listeners to display/evaluate text render operations.

Provides information and calculations needed by render listeners to display/evaluate text render operations.

This is passed between the iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor and iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener objects as text rendering operations are discovered

Constructor & Destructor Documentation

◆ TextRenderInfo()

iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.TextRenderInfo ( PdfString  str,
CanvasGraphicsState  gs,
Matrix  textMatrix,
Stack< CanvasTag canvasTagHierarchy 
)
inline

Creates a new TextRenderInfo object

Parameters
str the PDF string that should be displayed
gs the graphics state (note: at this time, this is not immutable, so don't cache it)
textMatrix the text matrix at the time of the render operation
canvasTagHierarchy the marked content tags sequence, if available

Member Function Documentation

◆ GetActualText()

virtual String iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetActualText ( )
inlinevirtual

Gets /ActualText tag entry value if this text chunk is marked content.

Returns
/ActualText value or null if none found

◆ GetAscentLine()

virtual LineSegment iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetAscentLine ( )
inlinevirtual

Gets the ascent line for the text (i.e. the line that represents the topmost extent that a string of the current font could have).

Gets the ascent line for the text (i.e. the line that represents the topmost extent that a string of the current font could have). This value includes the Rise of the draw operation - see GetRise() for the amount added by Rise.

Returns
a LineSegment instance

◆ GetBaseline()

virtual LineSegment iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetBaseline ( )
inlinevirtual

Gets the baseline for the text (i.e. the line that the text 'sits' on) This value includes the Rise of the draw operation - see GetRise() for the amount added by Rise

Returns
the baseline line segment

◆ GetCanvasTagHierarchy()

virtual IList<CanvasTag> iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetCanvasTagHierarchy ( )
inlinevirtual

Gets hierarchy of the canvas tags that wraps given text.

Returns
list of the wrapping canvas tags. The first tag is the innermost (nearest to the text).

◆ GetCharacterRenderInfos()

virtual IList<iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo> iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetCharacterRenderInfos ( )
inlinevirtual

Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation

Returns
A list of TextRenderInfo objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string

◆ GetDescentLine()

virtual LineSegment iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetDescentLine ( )
inlinevirtual

Gets the descent line for the text (i.e. the line that represents the bottom most extent that a string of the current font could have).

Gets the descent line for the text (i.e. the line that represents the bottom most extent that a string of the current font could have). This value includes the Rise of the draw operation - see GetRise() for the amount added by Rise.

Returns
a LineSegment instance

◆ GetExpansionText()

virtual String iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetExpansionText ( )
inlinevirtual

Gets /E tag (expansion text) entry value if this text chunk is marked content.

Returns
/E value or null if none found

◆ GetFont()

virtual PdfFont iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetFont ( )
inlinevirtual

Getter for the font

Returns
the font

◆ GetMcid()

virtual int iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetMcid ( )
inlinevirtual

Gets the marked-content identifier associated with this TextRenderInfo instance

Returns
associated marked-content identifier or -1 in case content is unmarked

◆ GetRise()

virtual float iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetRise ( )
inlinevirtual

The rise represents how far above the nominal baseline the text should be rendered.

The rise represents how far above the nominal baseline the text should be rendered. The GetBaseline() , GetAscentLine() and GetDescentLine() methods already include Rise. This method is exposed to allow listeners to determine if an explicit rise was involved in the computation of the baseline (this might be useful, for example, for identifying superscript rendering)

Returns
The Rise for the text draw operation, in user space units (Ts value, scaled to user space)

◆ GetText()

virtual String iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetText ( )
inlinevirtual

Gets the text to be rendered according to canvas operators.

Returns
the text to render

◆ GetTextMatrix()

virtual Matrix iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetTextMatrix ( )
inlinevirtual

Gets original Text matrix.

Returns
text matrix.

◆ GetTextRenderMode()

virtual int iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.GetTextRenderMode ( )
inlinevirtual
Returns
the text render mode that should be used for the text. From the PDF specification, this means:
  • 0 = Fill text
  • 1 = Stroke text
  • 2 = Fill, then stroke text
  • 3 = Invisible
  • 4 = Fill text and add to path for clipping
  • 5 = Stroke text and add to path for clipping
  • 6 = Fill, then stroke text and add to path for clipping
  • 7 = Add text to padd for clipping

◆ HasMcid() [1/2]

virtual bool iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.HasMcid ( int  mcid )
inlinevirtual

Checks if the text belongs to a marked content sequence with a given mcid.

Parameters
mcid a marked content id
Returns
true if the text is marked with this id

◆ HasMcid() [2/2]

virtual bool iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.HasMcid ( int  mcid,
bool  checkTheTopmostLevelOnly 
)
inlinevirtual

Checks if the text belongs to a marked content sequence with a given mcid.

Parameters
mcid a marked content id
checkTheTopmostLevelOnly indicates whether to check the topmost level of marked content stack only
Returns
true if the text is marked with this id

◆ IsReversedChars()

virtual bool iText.Kernel.Pdf.Canvas.Parser.Data.TextRenderInfo.IsReversedChars ( )
inlinevirtual

Determines if the text represented by this TextRenderInfo instance is written in a text showing operator wrapped by /ReversedChars marked content sequence

Returns
true if this text block lies within /ReversedChars block, false otherwise