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.PDFGraphicsStreamEngine
Example 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 PDFStreamEngine for further methods which may be overridden.
- Author:
- John Hewson
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomGraphicsStreamEngine(org.apache.pdfbox.pdmodel.PDPage page) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3) voidclip(int windingRule) voidvoidcurveTo(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) voidlineTo(float x, float y) static voidvoidmoveTo(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.voidMethods inherited from class org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine
getPageMethods 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
-
Constructor Details
-
CustomGraphicsStreamEngine
protected CustomGraphicsStreamEngine(org.apache.pdfbox.pdmodel.PDPage page) Constructor.- Parameters:
page- PDF Page
-
-
Method Details
-
main
- Throws:
IOException
-
run
Runs the engine on the current page.- Throws:
IOException- If there is an IO error while drawing the page.
-
appendRectangle
- Specified by:
appendRectanglein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
drawImage
- Specified by:
drawImagein classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
clip
- Specified by:
clipin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
moveTo
- Specified by:
moveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
lineTo
- Specified by:
lineToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
curveTo
- Specified by:
curveToin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
getCurrentPoint
- Specified by:
getCurrentPointin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
closePath
- Specified by:
closePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
endPath
- Specified by:
endPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
strokePath
- Specified by:
strokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
fillPath
- Specified by:
fillPathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
fillAndStrokePath
- Specified by:
fillAndStrokePathin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
shadingFill
- Specified by:
shadingFillin classorg.apache.pdfbox.contentstream.PDFGraphicsStreamEngine- Throws:
IOException
-
showTextString
Overridden from PDFStreamEngine.- Overrides:
showTextStringin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
IOException
-
showTextStrings
Overridden from PDFStreamEngine.- Overrides:
showTextStringsin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
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 IOException Overridden from PDFStreamEngine.- Overrides:
showGlyphin classorg.apache.pdfbox.contentstream.PDFStreamEngine- Throws:
IOException
-