GraphicsState

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

NameTypeAccessDescription
Ctmdouble[]ReadCurrent transformation matrix (CTM).
FillRdoubleRead/WriteFill color (RGB).
FillGdoubleRead/WriteGets or sets the fill g.
FillBdoubleRead/WriteGets or sets the fill b.
StrokeRdoubleRead/WriteStroke color (RGB).
StrokeGdoubleRead/WriteGets or sets the stroke g.
StrokeBdoubleRead/WriteGets or sets the stroke b.
LineWidthdoubleRead/WriteLine width.
LineCapintRead/WriteLine cap style (0=butt, 1=round, 2=square).
LineJoinintRead/WriteLine join style (0=miter, 1=round, 2=bevel).
MiterLimitdoubleRead/WriteMiter limit.
FlatnessdoubleRead/WriteFlatness tolerance.
FillAlphadoubleRead/WriteFill opacity (ca).
StrokeAlphadoubleRead/WriteStroke opacity (CA).
BlendModestringRead/WriteBlend mode (BM).
OverprintStrokeboolRead/WriteOverprint flag for stroking (OP).
OverprintFillboolRead/WriteOverprint flag for non-stroking (op).
ExtGStateNamestring?Read/WriteThe name of the current ExtGState resource, or null.
MarkedContentTagstring?Read/WriteCurrent marked content tag (set by BDC/BMC, cleared by EMC).
ActualTextstring?Read/WriteActualText from marked content properties (set by BDC with /ActualText).
DashArraydouble[]Read/WriteDash pattern array (d operator).
DashPhasedoubleRead/WriteDash phase (d operator).
FillColorSpacestringRead/WriteCurrent fill color space name (cs operator).
StrokeColorSpacestringRead/WriteCurrent stroke color space name (CS operator).
FillPatternNamestring?Read/WritePattern resource name set by scn when FillColorSpace is “Pattern”.
StrokePatternNamestring?Read/WritePattern resource name for stroking (SCN operator).
InTextObjectboolRead/WriteWhether we are inside a BT/ET text object.
FontNamestring?Read/WriteCurrent font resource name (e.g., “F1”).
FontSizedoubleRead/WriteCurrent font size.
CharSpacingdoubleRead/WriteCharacter spacing (Tc).
WordSpacingdoubleRead/WriteWord spacing (Tw).
HorizontalScalingdoubleRead/WriteHorizontal scaling (Tz).
LeadingdoubleRead/WriteText leading (TL).
RenderingModeintRead/WriteText rendering mode (Tr).
RisedoubleRead/WriteText rise (Ts).
TextMatrixdouble[]ReadText matrix (Tm).
TextLineMatrixdouble[]ReadText line matrix.
ClipMaskbyte[]?Read/WriteCurrent clipping path as a binary stencil (255 = pixel is inside clip, 0 = outside).

Methods

SignatureDescription
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.

See Also