Top Description Fields Constructors Methods
org.apache.pdfbox.contentstream

public abstract Class PDFGraphicsStreamEngine

extends PDFStreamEngine
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.rendering.PageDrawer
Imports
org.apache.pdfbox.cos.COSName, org.apache.pdfbox.pdmodel.PDPage, org.apache.pdfbox.pdmodel.graphics.image.PDImage, java.awt.geom.Point2D, java.io.IOException, org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor, .SetNonStrokingColorN, .SetNonStrokingColorSpace, .SetNonStrokingDeviceCMYKColor, .SetNonStrokingDeviceGrayColor, .SetNonStrokingDeviceRGBColor, .SetStrokingColor, .SetStrokingColorN, .SetStrokingColorSpace, .SetStrokingDeviceCMYKColor, .SetStrokingDeviceGrayColor, .SetStrokingDeviceRGBColor, org.apache.pdfbox.contentstream.operator.graphics.AppendRectangleToPath, .BeginInlineImage, .ClipEvenOddRule, .ClipNonZeroRule, .CloseAndStrokePath, .CloseFillEvenOddAndStrokePath, .CloseFillNonZeroAndStrokePath, .ClosePath, .CurveTo, .CurveToReplicateFinalPoint, .CurveToReplicateInitialPoint, .DrawObject, .EndPath, .FillEvenOddAndStrokePath, .FillEvenOddRule, .FillNonZeroAndStrokePath, .FillNonZeroRule, .LegacyFillNonZeroRule, .LineTo, .MoveTo, .ShadingFill, .StrokePath, org.apache.pdfbox.contentstream.operator.markedcontent.BeginMarkedContentSequence, .BeginMarkedContentSequenceWithProperties, .EndMarkedContentSequence, org.apache.pdfbox.contentstream.operator.state.Concatenate, .Restore, .Save, .SetFlatness, .SetGraphicsStateParameters, .SetLineCapStyle, .SetLineDashPattern, .SetLineJoinStyle, .SetLineMiterLimit, .SetLineWidth, .SetMatrix, .SetRenderingIntent, org.apache.pdfbox.contentstream.operator.text.BeginText, .EndText, .SetFontAndSize, .SetTextHorizontalScaling, .ShowTextAdjusted, .ShowTextLine, .ShowTextLineAndSpace, .MoveText, .MoveTextSetLeading, .NextLine, .SetCharSpacing, .SetTextLeading, .SetTextRenderingMode, .SetTextRise, .SetWordSpacing, .ShowText

PDFStreamEngine subclass for advanced processing of graphics. This class should be subclassed by end users looking to hook into graphics operations.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
private final PDPage

Constructor Summary

AccessConstructor and Description
protected
PDFGraphicsStreamEngine(PDPage
the page the content stream belongs to
page
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public abstract void
appendRectangle(Point2D
starting coordinate of the rectangle
p0
,
Point2D
second coordinate of the rectangle
p1
,
Point2D
third coordinate of the rectangle
p2
,
Point2D
last coordinate of the rectangle
p3
)

Append a rectangle to the current path.

public abstract void
clip(int
The winding rule which will be used for clipping.
windingRule
)

Modify the current clipping path by intersecting it with the current path.

public abstract void
closePath()

Closes the current path.

public abstract void
curveTo(float
the X coordinate of the first Bézier control point
x1
,
float
the Y coordinate of the first Bézier control point
y1
,
float
the X coordinate of the second Bézier control point
x2
,
float
the Y coordinate of the second Bézier control point
y2
,
float
the X coordinate of the final end point
x3
,
float
the Y coordinate of the final end point
y3
)

Draws a curve from the current point to (x3,y3) using (x1,y1) and (x2,y2) as control points.

public abstract void
drawImage(PDImage
The image to draw.
pdImage
)

Draw the image.

public abstract void
endPath()

Ends the current path without filling or stroking it.

public abstract void
fillAndStrokePath(int
The winding rule this path will use.
windingRule
)

Fills and then strokes the path.

public abstract void
fillPath(int
The winding rule this path will use.
windingRule
)

Fill the path.

public abstract Point2D

Returns:

the current point or null
getCurrentPoint
()

Returns the current point of the current path.

protected final PDPage

Returns:

the current page
getPage
()

Returns the page.

public abstract void
lineTo(float
the X-coordinate of the ending-point of the line to be drawn
x
,
float
the Y-coordinate of the ending-point of the line to be drawn
y
)

Draws a line from the current point to (x,y).

public abstract void
moveTo(float
the x-coordinate to move to
x
,
float
the y-coordinate to move to
y
)

Starts a new path at (x,y).

public abstract void
shadingFill(COSName
The name of the Shading Dictionary to use for this fill instruction.
shadingName
)

Fill with Shading.

public abstract void
strokePath()

Stroke the path.

Inherited from org.apache.pdfbox.contentstream.PDFStreamEngine:
addOperatorapplyTextAdjustmentbeginMarkedContentSequencebeginTextdecreaseLevelendMarkedContentSequenceendTextgetAppearancegetCurrentPagegetGraphicsStackSizegetGraphicsStategetInitialMatrixgetLevelgetResourcesgetTextLineMatrixgetTextMatrixincreaseLevelisShouldProcessColorOperatorsoperatorExceptionprocessAnnotationprocessChildStreamprocessOperatorprocessOperatorprocessPageprocessSoftMaskprocessTilingPatternprocessTilingPatternprocessTransparencyGroupprocessType3StreamrestoreGraphicsStackrestoreGraphicsStatesaveGraphicsStacksaveGraphicsStatesetLineDashPatternsetTextLineMatrixsetTextMatrixshowAnnotationshowFontGlyphshowFormshowGlyphshowTextshowTextStringshowTextStringsshowTransparencyGroupshowType3GlyphtransformedPointtransformWidthunsupportedOperator

Field Detail

pageback to summary
private final PDPage page

Constructor Detail

PDFGraphicsStreamEngineback to summary
protected PDFGraphicsStreamEngine(PDPage page)

Constructor.

Parameters
page:PDPage

the page the content stream belongs to

Method Detail

appendRectangleback to summary
public abstract void appendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3) throws IOException

Append a rectangle to the current path.

Parameters
p0:Point2D

starting coordinate of the rectangle

p1:Point2D

second coordinate of the rectangle

p2:Point2D

third coordinate of the rectangle

p3:Point2D

last coordinate of the rectangle

Exceptions
IOException:
if the rectangle could not be appended
clipback to summary
public abstract void clip(int windingRule) throws IOException

Modify the current clipping path by intersecting it with the current path. The clipping path will not be updated until the succeeding painting operator is called.

Parameters
windingRule:int

The winding rule which will be used for clipping.

Exceptions
IOException:
if the clipping path could not be modified
closePathback to summary
public abstract void closePath() throws IOException

Closes the current path.

Exceptions
IOException:
if the current path could not be closed
curveToback to summary
public abstract void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) throws IOException

Draws a curve from the current point to (x3,y3) using (x1,y1) and (x2,y2) as control points.

Parameters
x1:float

the X coordinate of the first Bézier control point

y1:float

the Y coordinate of the first Bézier control point

x2:float

the X coordinate of the second Bézier control point

y2:float

the Y coordinate of the second Bézier control point

x3:float

the X coordinate of the final end point

y3:float

the Y coordinate of the final end point

Exceptions
IOException:
if the curve could not be drawn
drawImageback to summary
public abstract void drawImage(PDImage pdImage) throws IOException

Draw the image.

Parameters
pdImage:PDImage

The image to draw.

Exceptions
IOException:
if the image could not be drawn
endPathback to summary
public abstract void endPath() throws IOException

Ends the current path without filling or stroking it. The clipping path is updated here.

Exceptions
IOException:
if the current path could not be ended
fillAndStrokePathback to summary
public abstract void fillAndStrokePath(int windingRule) throws IOException

Fills and then strokes the path.

Parameters
windingRule:int

The winding rule this path will use.

Exceptions
IOException:
if the path could not be filled and stroke
fillPathback to summary
public abstract void fillPath(int windingRule) throws IOException

Fill the path.

Parameters
windingRule:int

The winding rule this path will use.

Exceptions
IOException:
if the path could not be filled
getCurrentPointback to summary
public abstract Point2D getCurrentPoint() throws IOException

Returns the current point of the current path.

Returns:Point2D

the current point or null

Exceptions
IOException:
if the something went wrong when providing the current point
getPageback to summary
protected final PDPage getPage()

Returns the page.

Returns:PDPage

the current page

lineToback to summary
public abstract void lineTo(float x, float y) throws IOException

Draws a line from the current point to (x,y).

Parameters
x:float

the X-coordinate of the ending-point of the line to be drawn

y:float

the Y-coordinate of the ending-point of the line to be drawn

Exceptions
IOException:
if the line could not be drawn
moveToback to summary
public abstract void moveTo(float x, float y) throws IOException

Starts a new path at (x,y).

Parameters
x:float

the x-coordinate to move to

y:float

the y-coordinate to move to

Exceptions
IOException:
if the something went wrong when moving to the given coordinate
shadingFillback to summary
public abstract void shadingFill(COSName shadingName) throws IOException

Fill with Shading.

Parameters
shadingName:COSName

The name of the Shading Dictionary to use for this fill instruction.

Exceptions
IOException:
if the path could not be filled using the given shading
strokePathback to summary
public abstract void strokePath() throws IOException

Stroke the path.

Exceptions
IOException:
If there is an IO error while stroking the path.