API Reference
PdfTextSpan
A piece of text extracted from a PDF page with basic font and position info. Coordinates are in user space units (points) as emitted by content stream Tm/Td.
Inheritance
- Object
- PdfTextSpan
Usage
Explore 10 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 8
- Method IPdfGlyphDecodingStage.Decode
- Property PdfLogicalTextBlock.Spans
- Property PdfLogicalTextRun.SourceSpan
- Method PdfReadPage.GetTextSpans
- Property PdfRegionText.Spans
- Property PdfUnderstandingPageResult.DecodedRuns
- Property PdfUnderstandingWord.SourceRuns
- Property StructuredLine.Spans
Accepted by parameters 2
- Method IPdfWordGroupingStage.GroupWords
- Constructor PdfUnderstandingWord.PdfUnderstandingWord
Constructors
public PdfTextSpan(String text, String fontResource, Double fontSize, Double x, Double y, Double advance = 0, OfficeColor? color = null, Boolean isVisible = true, Double rotationDegrees = 0, String? baseFont = null) #Creates a new text span.
Parameters
- text System.String
- fontResource System.String
- fontSize System.Double
- x System.Double
- y System.Double
- advance System.Double = 0
- color OfficeIMO.Drawing.OfficeColor? = null
- isVisible System.Boolean = true
- rotationDegrees System.Double = 0
- baseFont System.String? = null
public PdfTextSpan(String text, String fontResource, Double fontSize, Double x, Double y, Double advance, OfficeColor? color, Boolean isVisible, Double rotationDegrees, String? baseFont, Int32? fontWeight, Int32? fontDescriptorFlags) #Creates a new text span with explicit PDF font descriptor style evidence.
Parameters
- text System.String
- fontResource System.String
- fontSize System.Double
- x System.Double
- y System.Double
- advance System.Double
- color OfficeIMO.Drawing.OfficeColor?
- isVisible System.Boolean
- rotationDegrees System.Double
- baseFont System.String?
- fontWeight System.Int32?
- fontDescriptorFlags System.Int32?
Methods
public Boolean TryGetGlyphs(out IReadOnlyList<PdfTextGlyph> glyphs) #BooleanProjects the reader's glyph codes, text ranges and baseline origins into immutable evidence. Returns false with an empty list when glyph evidence is unavailable or the logical text cannot be mapped to painted glyphs, including ambiguous ActualText replacements. The origins describe the baseline; they are not exact glyph outlines or clipping bounds.
Parameters
- glyphs System.Collections.Generic.IReadOnlyList<OfficeIMO.Pdf.PdfTextGlyph>
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public PdfTextDecodingEvidence DecodingEvidence { get; private set; } #Immutable evidence describing the mapping used for this native text run.
public String FontResource { get; } #Font resource name from the page resources (e.g., F1).
public String? BaseFont { get; } #PDF base font name resolved from the active resource dictionary, when available.
public Int32? FontWeight { get; } #Font descriptor weight from 1 through 1000, when declared by the PDF.
public Int32? FontDescriptorFlags { get; } #Raw PDF font descriptor flags, when declared by the PDF.
public Boolean IsBold { get; } #True when declared weight or legacy font-name evidence identifies a bold face.
public Boolean IsItalic { get; } #True when descriptor flags or legacy font-name evidence identifies an italic face.
public Double Advance { get; } #Advance width in user space for this span (includes spacing and hscale).
public OfficeColor? Color { get; } #Fill color used for visual text rendering, when it could be read from the content stream.
public Boolean IsVisible { get; } #True when the text span should be painted during visual rendering.
public Double RotationDegrees { get; } #Baseline rotation in PDF user-space degrees, where positive angles are counter-clockwise.
public Int32? MarkedContentId { get; } #Active content-stream-scoped marked-content identifier from a tagged PDF, when present.
public Int32? ContentStreamObjectNumber { get; } #Form XObject or other content-stream object owning the MCID, or null for page content.
public Int32 TextRenderingMode { get; } #PDF text rendering mode active for this span (0 through 7).
public Boolean HasActualText { get; } #True when marked-content ActualText replaced the logical text.
public Boolean IsArtifactContent { get; } #True when this span came from PDF content explicitly marked as an /Artifact.