Table of Contents

Interface IOperationContext

Namespace
UglyToad.PdfPig.Graphics
Assembly
UglyToad.PdfPig.dll

The current graphics state context when running a PDF content stream.

public interface IOperationContext

Properties

CurrentPosition

The current position.

PdfPoint CurrentPosition { get; set; }

Property Value

PdfPoint

StackSize

The number of graphics states on the stack.

int StackSize { get; }

Property Value

int

TextMatrices

The matrices for the current text state.

TextMatrices TextMatrices { get; }

Property Value

TextMatrices

Methods

ApplyXObject(NameToken)

Retrieves the named XObject and applies it to the current state.

void ApplyXObject(NameToken xObjectName)

Parameters

xObjectName NameToken

The name of the XObject.

BeginInlineImage()

Indicate that an inline image is being defined.

void BeginInlineImage()

BeginMarkedContent(NameToken, NameToken, DictionaryToken)

Indicate that a marked content region is started.

void BeginMarkedContent(NameToken name, NameToken propertyDictionaryName, DictionaryToken properties)

Parameters

name NameToken
propertyDictionaryName NameToken
properties DictionaryToken

BeginSubpath()

Start a new sub-path.

void BeginSubpath()

BezierCurveTo(double, double, double, double)

Add a bezier curve to the current subpath.

Should implement matrix transformations.

void BezierCurveTo(double x2, double y2, double x3, double y3)

Parameters

x2 double
y2 double
x3 double
y3 double

BezierCurveTo(double, double, double, double, double, double)

Add a bezier curve to the current subpath.

Should implement matrix transformations.

void BezierCurveTo(double x1, double y1, double x2, double y2, double x3, double y3)

Parameters

x1 double
y1 double
x2 double
y2 double
x3 double
y3 double

ClosePath()

Close the current path.

void ClosePath()

CloseSubpath()

Close the current subpath.

PdfPoint? CloseSubpath()

Returns

PdfPoint?

EndInlineImage(IReadOnlyList<byte>)

Indicates that the current inline image is complete.

void EndInlineImage(IReadOnlyList<byte> bytes)

Parameters

bytes IReadOnlyList<byte>

EndMarkedContent()

Indicates that the current marked content region is complete.

void EndMarkedContent()

EndPath()

End the path object without filling or stroking it. This operator shall be a path-painting no-op, used primarily for the side effect of changing the current clipping path (see 8.5.4, "Clipping Path Operators").

void EndPath()

FillPath(FillingRule, bool)

Fill the current path.

void FillPath(FillingRule fillingRule, bool close)

Parameters

fillingRule FillingRule

The filling rule to use.

close bool

Whether to also close the path.

FillStrokePath(FillingRule, bool)

Fill and stroke the current path.

void FillStrokePath(FillingRule fillingRule, bool close)

Parameters

fillingRule FillingRule

The filling rule to use.

close bool

Whether to also close the path.

GetCurrentState()

Gets the current graphic state.

CurrentGraphicsState GetCurrentState()

Returns

CurrentGraphicsState

LineTo(double, double)

Add a line command to the subpath.

Should implement matrix transformations.

void LineTo(double x, double y)

Parameters

x double
y double

ModifyClippingIntersect(FillingRule)

Modify the clipping rule of the current path.

void ModifyClippingIntersect(FillingRule clippingRule)

Parameters

clippingRule FillingRule

ModifyCurrentTransformationMatrix(double[])

Modify the current transformation matrix by concatenating the specified matrix.

void ModifyCurrentTransformationMatrix(double[] value)

Parameters

value double[]

MoveTo(double, double)

Add a move command to the path.

Should implement matrix transformations.

void MoveTo(double x, double y)

Parameters

x double
y double

MoveToNextLineWithOffset()

Move to the start of the next line.

void MoveToNextLineWithOffset()

Remarks

This performs this operation: 0 -Tl Td The offset is negative leading text (Tl) value, this is incorrect in the specification.

PaintShading(NameToken)

Paint the shape and colour shading described by a shading dictionary, subject to the current clipping path. The current colour in the graphics state is neither used nor altered. The effect is different from that of painting a path using a shading pattern as the current colour.

void PaintShading(NameToken shading)

Parameters

shading NameToken

The name of a shading dictionary resource in the Shading subdictionary of the current resource dictionary.

PopState()

Sets the current graphics state to the state from the top of the stack.

void PopState()

PushState()

Saves a copy of the current graphics state on the stack.

void PushState()

Rectangle(double, double, double, double)

Add a rectangle following the pdf specification (m, l, l, l, c) path. A new subpath will be created.

Should implement matrix transformations.

void Rectangle(double x, double y, double width, double height)

Parameters

x double
y double
width double
height double

SetCharacterSpacing(double)

Set the character spacing to a number expressed in unscaled text space units. Initial value: 0.

void SetCharacterSpacing(double spacing)

Parameters

spacing double

SetFlatnessTolerance(decimal)

Set the flatness tolerance in the graphics state. Flatness is a number in the range 0 to 100; a value of 0 specifies the output device’s default flatness tolerance.

void SetFlatnessTolerance(decimal tolerance)

Parameters

tolerance decimal

SetFontAndSize(NameToken, double)

Set the font and the font size. Font is the name of a font resource in the Font subdictionary of the current resource dictionary. Size is a number representing a scale factor.

void SetFontAndSize(NameToken font, double size)

Parameters

font NameToken
size double

SetHorizontalScaling(double)

Set the horizontal scaling.

void SetHorizontalScaling(double scale)

Parameters

scale double

SetInlineImageProperties(IReadOnlyDictionary<NameToken, IToken>)

Define the properties of the inline image currently being drawn.

void SetInlineImageProperties(IReadOnlyDictionary<NameToken, IToken> properties)

Parameters

properties IReadOnlyDictionary<NameToken, IToken>

SetLineCap(LineCapStyle)

Set the line cap style in the graphics state.

void SetLineCap(LineCapStyle cap)

Parameters

cap LineCapStyle

SetLineDashPattern(LineDashPattern)

Set the line dash pattern in the graphics state.

void SetLineDashPattern(LineDashPattern pattern)

Parameters

pattern LineDashPattern

SetLineJoin(LineJoinStyle)

Set the line join style in the graphics state.

void SetLineJoin(LineJoinStyle join)

Parameters

join LineJoinStyle

SetLineWidth(decimal)

Set the line width in the graphics state.

void SetLineWidth(decimal width)

Parameters

width decimal

SetMiterLimit(decimal)

Set the miter limit in the graphics state.

void SetMiterLimit(decimal limit)

Parameters

limit decimal

SetNamedGraphicsState(NameToken)

Update the graphics state to apply the state from the named ExtGState dictionary.

void SetNamedGraphicsState(NameToken stateName)

Parameters

stateName NameToken

The name of the state to apply.

SetTextLeading(double)

Set the text leading.

void SetTextLeading(double leading)

Parameters

leading double

SetTextRenderingMode(TextRenderingMode)

Set the text rendering mode.

void SetTextRenderingMode(TextRenderingMode mode)

Parameters

mode TextRenderingMode

SetTextRise(double)

Set text rise.

void SetTextRise(double rise)

Parameters

rise double

SetWordSpacing(double)

Sets the word spacing.

void SetWordSpacing(double spacing)

Parameters

spacing double

ShowPositionedText(IReadOnlyList<IToken>)

Interprets the tokens to draw text at positions.

void ShowPositionedText(IReadOnlyList<IToken> tokens)

Parameters

tokens IReadOnlyList<IToken>

The tokens to show.

ShowText(IInputBytes)

Shows the text represented by the provided bytes using the current graphics state.

void ShowText(IInputBytes bytes)

Parameters

bytes IInputBytes

The bytes of the text.

StrokePath(bool)

Stroke the current path.

void StrokePath(bool close)

Parameters

close bool

Whether to also close the path.