Skip to content

PdfContentStream Class

Definition

Namespace: Xfinium.Pdf.Graphics

Defines a low level graphics interface for drawing content on PDF pages.

C#
public class PdfContentStream : Object

Inheritance: Object → PdfContentStream

Remarks

The methods in this class match the PDF operators defined in the PDF specification.
A PdfContentStream object is created from a PdfGraphics object and lets you inject specific PDF operators in the PdfGraphics object, operators that are not available through the public API.
This class gives you full control over the generated page content but it requires good knowledge of PDF specification.

Constructor

Name Description
PdfContentStream(PdfGraphics) Initializes a new PdfContentStream object.

Methods

Name Description
AddOperator Adds the given operator to the content stream.
BeginCompatibilitySection Begins a compatibility section.
Operator: BX.
BeginInlineImage Begins an inline image.
Operator: BI.
BeginInlineImageData Begins the data section of an inline image.
Operator: ID.
BeginMarkedContent Begins a marked-content sequence.
BeginMarkedContentWithPropertyList Begins a marked-content sequence with an associated property list.
BeginText Begins a text section.
Operator: BT.
CCurveTo Append a cubic Bézier curve to the current path.
Operator: c
Clear Clears the entire content stream.
CloseAndStrokePath Closes and strokes the current path.
Operator: s.
CloseFillNonZeroStroke Closes the current path, fills the path using the fillMode and then strokes the path.
Operator: b for PdfFillMode.NonZeroWinding or b* for PdfFillMode.EvenOdd.
CloseSubpath Closes the current path.
Operator: h.
ConcatenateMatrix Concatenates the given matrix with the current transformation matrix.
Operator: cm
DefineMarkedContentPoint Defines a marked-content point.
DefineMarkedContentPointWithPropertyList Defines a marked-content point with an associated property list.
EndCompatibilitySection Ends a compatibility section.
Operator: EX.
EndInlineImage Ends an inline image.
Operator: EI.
EndMarkedContent Ends a marked content section.
Operator: EMC.
EndPath Ends the current path.
Operator: n.
EndText Ends a text section.
Operator: ET.
FillNonZeroStroke Fills the current path using the fillMode and then strokes the path.
Operator: B for PdfFillMode.NonZeroWinding or B* for PdfFillMode.EvenOdd.
FillPath Fills the current path using the fillMode.
Operator: f for PdfFillMode.NonZeroWinding or f* for PdfFillMode.EvenOdd.
LineTo Appends a line segment to current path from current point to (x, y).
Operator: l
MoveTextPosition Moves the text position.
Operator: Td
MoveTextPositionAndSetLeading Moves the text position.
Operator: TD
MoveTo Begins a new subpath at (x, y).
Operator: m
MoveToStartOfNextTextLine Moves to the start of the next line.
Operator: T*
Rectangle Appends a rectangle to current path.
Operator: re
ResetPdfCoordinateSystem Resets the coordinate system to default PDF coordinate system.
RestoreGraphicsState Restores the current graphics state.
Operator: Q.
RestoreVisualCoordinateSystem Restores the coordinate system as it has been setup initially by PdfGraphics class.
SaveGraphicsState Saves the current graphics state.
Operator: q.
SetCharacterSpacing Sets the character spacing.
Operator: Tc
SetClipPath Sets the current path as clipping path.
Operator: W for PdfFillMode.NonZeroWinding or W* for PdfFillMode.EvenOdd.
SetCmykFillColor Sets the current colorspace for fill operations to DeviceCMYK and sets the current CMYK color.
Operator: k
SetCmykStrokeColor Sets the current colorspace for stroke operations to DeviceCMYK and sets the current CMYK color.
Operator: K
SetExtendedGraphicsState Sets the current graphics state in the content stream.
Operator: gs
SetFillColor Sets the current fill color.
Operator: sc
SetFillColorN Sets the current fill color.
Operator: scn
SetFillColorSpace Sets the fill colorspace.
Operator: cs
SetFlatnessTolerance Set the flatness tolerance in the graphics state.
Operator: i
SetGrayFillColor Sets the current colorspace for fill operations to DeviceGray and sets the gray level.
Operator: g
SetGrayStrokeColor Sets the current colorspace for stroke operations to DeviceGray and sets the gray level.
Operator: g
SetLineCap Set the line cap style in the graphics state.
Operator: J
SetLineDashPattern Sets the dash offset and pattern for stroke operations.
Operator: d
SetLineJoin Set the line join style in the graphics state.
Operator: j
SetLineWidth Sets the line width in the graphics state.
SetMiterLimit Set the miter limit in the graphics state.
Operator: M
SetRgbFillColor Sets the current colorspace for fill operations to DeviceRGB and sets the current RGB color.
Operator: rg
SetRgbStrokeColor Sets the current colorspace for stroke operations to DeviceRGB and sets the current RGB color.
Operator: RG
SetStrokeColor Sets the current stroke color.
Operator: SC
SetStrokeColorN Sets the current stroke color.
Operator: SCN
SetStrokeColorSpace Sets the stroke colorspace.
Operator: CS
SetTextFontAndSize Sets the current font and size for text show operators.
Operator: Tf
SetTextHorizontalScaling Sets the text horizontal scaling.
Operator: Tz
SetTextLeading Sets the text leading.
Operator: TL
SetTextMatrix Sets the current text matrix and text line matrix.
Operator: Tm
SetTextRendering Sets the text rendering mode.
Operator: Tr
SetTextRise Sets the text rise.
Operator: Ts
SetWordSpacing Sets the word spacing.
Operator: Tw
ShowFormXObject Shows a form XObject on the page.
Operator: Do
ShowImage Shows an image on the page.
Operator: Do
ShowShading Shows a shading on the page.
Operator: sh
ShowText Shows the specified text on the page.
Operator: Tj
ShowTextArray Shows one or more text strings, allowing individual glyph positioning.
StrokePath Strokes the current path.
Operator: S.
VCurveTo Append a cubic Bézier curve to the current path.
Operator: v
WriteByte Writes the specified byte to the content stream.
WriteBytes Writes the specified bytes to the content stream.
YCurveTo Append a cubic Bézier curve to the current path.
Operator: y