Class CustomGraphicsStreamEngine
- java.lang.Object
-
- org.apache.pdfbox.contentstream.PDFStreamEngine
-
- org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
-
- org.apache.pdfbox.examples.rendering.CustomGraphicsStreamEngine
-
public class CustomGraphicsStreamEngine extends org.apache.pdfbox.contentstream.PDFGraphicsStreamEngineExample of a custom PDFGraphicsStreamEngine subclass. Allows text and graphics to be processed in a custom manner. This example simply prints the operations to stdout.See
PDFStreamEnginefor further methods which may be overridden.- Author:
- John Hewson
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCustomGraphicsStreamEngine(org.apache.pdfbox.pdmodel.PDPage page)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendRectangle(java.awt.geom.Point2D p0, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3)voidclip(int windingRule)voidclosePath()voidcurveTo(float x1, float y1, float x2, float y2, float x3, float y3)voiddrawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage)voidendPath()voidfillAndStrokePath(int windingRule)voidfillPath(int windingRule)java.awt.geom.Point2DgetCurrentPoint()voidlineTo(float x, float y)static voidmain(java.lang.String[] args)voidmoveTo(float x, float y)voidrun()Runs the engine on the current page.voidshadingFill(org.apache.pdfbox.cos.COSName shadingName)protected voidshowGlyph(org.apache.pdfbox.util.Matrix textRenderingMatrix, org.apache.pdfbox.pdmodel.font.PDFont font, int code, org.apache.pdfbox.util.Vector displacement)Overridden from PDFStreamEngine.voidshowTextString(byte[] string)Overridden from PDFStreamEngine.voidshowTextStrings(org.apache.pdfbox.cos.COSArray array)Overridden from PDFStreamEngine.voidstrokePath()-
Methods inherited from class org.apache.pdfbox.contentstream.PDFStreamEngine
addOperator, applyTextAdjustment, beginMarkedContentSequence, beginText, decreaseLevel, endMarkedContentSequence, endText, getAppearance, getCurrentPage, getGraphicsStackSize, getGraphicsState, getInitialMatrix, getLevel, getResources, getTextLineMatrix, getTextMatrix, increaseLevel, isShouldProcessColorOperators, markedContentPoint, operatorException, processAnnotation, processChildStream, processOperator, processOperator, processPage, processSoftMask, processTilingPattern, processTilingPattern, processTransparencyGroup, processType3Stream, restoreGraphicsStack, restoreGraphicsState, saveGraphicsStack, saveGraphicsState, setLineDashPattern, setTextLineMatrix, setTextMatrix, showAnnotation, showFontGlyph, showForm, showText, showTransparencyGroup, showType3Glyph, transformedPoint, transformWidth, unsupportedOperator
-
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.io.IOException- Throws:
java.io.IOException
-
run
public void run() throws java.io.IOExceptionRuns the engine on the current page.- Throws:
java.io.IOException- If there is an IO error while drawing the page.
-
appendRectangle
public void appendRectangle(java.awt.geom.Point2D p0, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3) throws java.io.IOException- Specified by:
appendRectanglein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
drawImage
public void drawImage(org.apache.pdfbox.pdmodel.graphics.image.PDImage pdImage) throws java.io.IOException- Specified by:
drawImagein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
clip
public void clip(int windingRule) throws java.io.IOException- Specified by:
clipin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
moveTo
public void moveTo(float x, float y) throws java.io.IOException- Specified by:
moveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
lineTo
public void lineTo(float x, float y) throws java.io.IOException- Specified by:
lineToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
curveTo
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) throws java.io.IOException- Specified by:
curveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
getCurrentPoint
public java.awt.geom.Point2D getCurrentPoint() throws java.io.IOException- Specified by:
getCurrentPointin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
closePath
public void closePath() throws java.io.IOException- Specified by:
closePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
endPath
public void endPath() throws java.io.IOException- Specified by:
endPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
strokePath
public void strokePath() throws java.io.IOException- Specified by:
strokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
fillPath
public void fillPath(int windingRule) throws java.io.IOException- Specified by:
fillPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
fillAndStrokePath
public void fillAndStrokePath(int windingRule) throws java.io.IOException- Specified by:
fillAndStrokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
shadingFill
public void shadingFill(org.apache.pdfbox.cos.COSName shadingName) throws java.io.IOException- Specified by:
shadingFillin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
java.io.IOException
-
showTextString
public void showTextString(byte[] string) throws java.io.IOExceptionOverridden from PDFStreamEngine.- Overrides:
showTextStringin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
java.io.IOException
-
showTextStrings
public void showTextStrings(org.apache.pdfbox.cos.COSArray array) throws java.io.IOExceptionOverridden from PDFStreamEngine.- Overrides:
showTextStringsin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
java.io.IOException
-
showGlyph
protected void showGlyph(org.apache.pdfbox.util.Matrix textRenderingMatrix, org.apache.pdfbox.pdmodel.font.PDFont font, int code, org.apache.pdfbox.util.Vector displacement) throws java.io.IOExceptionOverridden from PDFStreamEngine.- Overrides:
showGlyphin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
java.io.IOException
-
-