GraphicsState
Overview
GraphicsState is a class in Aspose.PDF FOSS for .NET.
Tracks the PDF graphics state during content stream parsing (PDF32000 §8.4).
This class provides 10 methods for working with GraphicsState objects in .NET programs.
Available methods include: AdvanceTextPosition, ConcatMatrix, GetEffectiveFontSize, GetTextPosition, MoveTextPosition, MoveToNextLine, Restore, Save, SetTextMatrix, TransformPoint.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: ActualText, BlendMode, CharSpacing, ClipMask, Ctm, DashArray, and 32 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Ctm | double[] | Read | Current transformation matrix (CTM). |
FillR | double | Read/Write | Fill color (RGB). |
FillG | double | Read/Write | Gets or sets the fill g. |
FillB | double | Read/Write | Gets or sets the fill b. |
StrokeR | double | Read/Write | Stroke color (RGB). |
StrokeG | double | Read/Write | Gets or sets the stroke g. |
StrokeB | double | Read/Write | Gets or sets the stroke b. |
LineWidth | double | Read/Write | Line width. |
LineCap | int | Read/Write | Line cap style (0=butt, 1=round, 2=square). |
LineJoin | int | Read/Write | Line join style (0=miter, 1=round, 2=bevel). |
MiterLimit | double | Read/Write | Miter limit. |
Flatness | double | Read/Write | Flatness tolerance. |
FillAlpha | double | Read/Write | Fill opacity (ca). |
StrokeAlpha | double | Read/Write | Stroke opacity (CA). |
BlendMode | string | Read/Write | Blend mode (BM). |
OverprintStroke | bool | Read/Write | Overprint flag for stroking (OP). |
OverprintFill | bool | Read/Write | Overprint flag for non-stroking (op). |
ExtGStateName | string? | Read/Write | The name of the current ExtGState resource, or null. |
MarkedContentTag | string? | Read/Write | Current marked content tag (set by BDC/BMC, cleared by EMC). |
ActualText | string? | Read/Write | ActualText from marked content properties (set by BDC with /ActualText). |
DashArray | double[] | Read/Write | Dash pattern array (d operator). |
DashPhase | double | Read/Write | Dash phase (d operator). |
FillColorSpace | string | Read/Write | Current fill color space name (cs operator). |
StrokeColorSpace | string | Read/Write | Current stroke color space name (CS operator). |
FillPatternName | string? | Read/Write | Pattern resource name set by scn when FillColorSpace is “Pattern”. |
StrokePatternName | string? | Read/Write | Pattern resource name for stroking (SCN operator). |
InTextObject | bool | Read/Write | Whether we are inside a BT/ET text object. |
FontName | string? | Read/Write | Current font resource name (e.g., “F1”). |
FontSize | double | Read/Write | Current font size. |
CharSpacing | double | Read/Write | Character spacing (Tc). |
WordSpacing | double | Read/Write | Word spacing (Tw). |
HorizontalScaling | double | Read/Write | Horizontal scaling (Tz). |
Leading | double | Read/Write | Text leading (TL). |
RenderingMode | int | Read/Write | Text rendering mode (Tr). |
Rise | double | Read/Write | Text rise (Ts). |
TextMatrix | double[] | Read | Text matrix (Tm). |
TextLineMatrix | double[] | Read | Text line matrix. |
ClipMask | byte[]? | Read/Write | Current clipping path as a binary stencil (255 = pixel is inside clip, 0 = outside). |
Methods
| Signature | Description |
|---|---|
Save() | Push the current state onto the stack (q operator). |
Restore() | Restore the most recently saved state (Q operator). |
ConcatMatrix(a: double, b: double, c: double, d: double, e: double, f: double) | Concatenate a matrix to the CTM (cm operator). |
SetTextMatrix(a: double, b: double, c: double, d: double, e: double, f: double) | Set the text matrix directly (Tm operator). |
MoveTextPosition(tx: double, ty: double) | Move text position (Td operator). |
AdvanceTextPosition(tx: double, ty: double) | Advance text position after showing a string (Tj/TJ). |
MoveToNextLine() | Move to start of next line (T* operator). |
TransformPoint(x: double, y: double) | Transform a point from user space to device space using the CTM. |
GetTextPosition() | Get the absolute position of text using both CTM and text matrix. |
GetEffectiveFontSize() | Get the effective font size considering text matrix scaling and CTM. |