PDFGraphicsStreamEngine, PDFMarkedContentExtractor, PDFTextStripperpublic abstract class PDFStreamEngine
extends java.lang.Object
| Modifier | Constructor | Description |
|---|---|---|
protected |
PDFStreamEngine() |
Creates a new PDFStreamEngine.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addOperator(OperatorProcessor op) |
Adds an operator processor to the engine.
|
protected void |
applyTextAdjustment(float tx,
float ty) |
Applies a text position adjustment from the TJ operator.
|
void |
beginText() |
Called when the BT operator is encountered.
|
void |
endText() |
Called when the ET operator is encountered.
|
PDAppearanceStream |
getAppearance(PDAnnotation annotation) |
Returns the appearance stream to process for the given annotation.
|
PDPage |
getCurrentPage() |
|
int |
getGraphicsStackSize() |
|
PDGraphicsState |
getGraphicsState() |
|
Matrix |
getInitialMatrix() |
Gets the stream's initial matrix.
|
PDResources |
getResources() |
|
Matrix |
getTextLineMatrix() |
|
Matrix |
getTextMatrix() |
|
protected void |
operatorException(Operator operator,
java.util.List<COSBase> operands,
java.io.IOException e) |
Called when an exception is thrown by an operator.
|
protected void |
processAnnotation(PDAnnotation annotation,
PDAppearanceStream appearance) |
Process the given annotation with the specified appearance stream.
|
protected void |
processChildStream(PDContentStream contentStream,
PDPage page) |
Process a child stream of the given page.
|
void |
processOperator(java.lang.String operation,
java.util.List<COSBase> arguments) |
This is used to handle an operation.
|
protected void |
processOperator(Operator operator,
java.util.List<COSBase> operands) |
This is used to handle an operation.
|
void |
processPage(PDPage page) |
This will initialise and process the contents of the stream.
|
protected void |
processSoftMask(PDTransparencyGroup group) |
Processes a soft mask transparency group stream.
|
protected void |
processTilingPattern(PDTilingPattern tilingPattern,
PDColor color,
PDColorSpace colorSpace) |
Process the given tiling pattern.
|
protected void |
processTilingPattern(PDTilingPattern tilingPattern,
PDColor color,
PDColorSpace colorSpace,
Matrix patternMatrix) |
Process the given tiling pattern.
|
protected void |
processTransparencyGroup(PDTransparencyGroup group) |
Processes a transparency group stream.
|
protected void |
processType3Stream(PDType3CharProc charProc,
Matrix textRenderingMatrix) |
Processes a Type 3 character stream.
|
void |
registerOperatorProcessor(java.lang.String operator,
OperatorProcessor op) |
Deprecated.
Use
addOperator(OperatorProcessor) instead |
protected void |
restoreGraphicsStack(java.util.Stack<PDGraphicsState> snapshot) |
Restores the entire graphics stack.
|
void |
restoreGraphicsState() |
Pops the current graphics state from the stack.
|
protected java.util.Stack<PDGraphicsState> |
saveGraphicsStack() |
Saves the entire graphics stack.
|
void |
saveGraphicsState() |
Pushes the current graphics state to the stack.
|
void |
setLineDashPattern(COSArray array,
int phase) |
|
void |
setTextLineMatrix(Matrix value) |
|
void |
setTextMatrix(Matrix value) |
|
void |
showAnnotation(PDAnnotation annotation) |
Shows the given annotation.
|
protected void |
showFontGlyph(Matrix textRenderingMatrix,
PDFont font,
int code,
java.lang.String unicode,
Vector displacement) |
Called when a glyph is to be processed.This method is intended for overriding in subclasses,
the default implementation does nothing.
|
void |
showForm(PDFormXObject form) |
Shows a form from the content stream.
|
protected void |
showGlyph(Matrix textRenderingMatrix,
PDFont font,
int code,
java.lang.String unicode,
Vector displacement) |
Called when a glyph is to be processed.This method is intended for overriding in subclasses,
the default implementation does nothing.
|
protected void |
showText(byte[] string) |
Process text from the PDF Stream.
|
void |
showTextString(byte[] string) |
Called when a string of text is to be shown.
|
void |
showTextStrings(COSArray array) |
Called when a string of text with spacing adjustments is to be shown.
|
void |
showTransparencyGroup(PDTransparencyGroup form) |
Shows a transparency group from the content stream.
|
protected void |
showType3Glyph(Matrix textRenderingMatrix,
PDType3Font font,
int code,
java.lang.String unicode,
Vector displacement) |
Called when a glyph is to be processed.This method is intended for overriding in subclasses,
the default implementation does nothing.
|
java.awt.geom.Point2D.Float |
transformedPoint(float x,
float y) |
Transforms a point using the CTM.
|
protected float |
transformWidth(float width) |
Transforms a width using the CTM.
|
protected void |
unsupportedOperator(Operator operator,
java.util.List<COSBase> operands) |
Called when an unsupported operator is encountered.
|
@Deprecated
public void registerOperatorProcessor(java.lang.String operator,
OperatorProcessor op)
addOperator(OperatorProcessor) insteadoperator - The operator as a string.op - Processor instance.public final void addOperator(OperatorProcessor op)
op - operator processorpublic void processPage(PDPage page) throws java.io.IOException
page - the page to processjava.io.IOException - if there is an error accessing the streampublic void showTransparencyGroup(PDTransparencyGroup form) throws java.io.IOException
form - transparency group (form) XObjectjava.io.IOException - if the transparency group cannot be processedpublic void showForm(PDFormXObject form) throws java.io.IOException
form - form XObjectjava.io.IOException - if the form cannot be processedprotected void processSoftMask(PDTransparencyGroup group) throws java.io.IOException
group - the transparency group.java.io.IOExceptionprotected void processTransparencyGroup(PDTransparencyGroup group) throws java.io.IOException
group - the transparency group.java.io.IOExceptionprotected void processType3Stream(PDType3CharProc charProc, Matrix textRenderingMatrix) throws java.io.IOException
charProc - Type 3 character proceduretextRenderingMatrix - the Text Rendering Matrixjava.io.IOException - if there is an error reading or parsing the character content stream.protected void processAnnotation(PDAnnotation annotation, PDAppearanceStream appearance) throws java.io.IOException
annotation - The annotation containing the appearance stream to process.appearance - The appearance stream to process.java.io.IOException - If there is an error reading or parsing the appearance content stream.protected final void processTilingPattern(PDTilingPattern tilingPattern, PDColor color, PDColorSpace colorSpace) throws java.io.IOException
tilingPattern - the tiling patterncolor - color to use, if this is an uncoloured pattern, otherwise null.colorSpace - color space to use, if this is an uncoloured pattern, otherwise null.java.io.IOException - if there is an error reading or parsing the tiling pattern content stream.protected final void processTilingPattern(PDTilingPattern tilingPattern, PDColor color, PDColorSpace colorSpace, Matrix patternMatrix) throws java.io.IOException
tilingPattern - the tiling patterncolor - color to use, if this is an uncoloured pattern, otherwise null.colorSpace - color space to use, if this is an uncoloured pattern, otherwise null.patternMatrix - the pattern matrix, may be overridden for custom rendering.java.io.IOException - if there is an error reading or parsing the tiling pattern content stream.public void showAnnotation(PDAnnotation annotation) throws java.io.IOException
annotation - An annotation on the current page.java.io.IOException - If an error occurred reading the annotationpublic PDAppearanceStream getAppearance(PDAnnotation annotation)
annotation - The current annotation.protected void processChildStream(PDContentStream contentStream, PDPage page) throws java.io.IOException
processPage(PDPage).contentStream - the child content streampage - the current pagejava.io.IOException - if there is an exception while processing the streampublic void beginText()
throws java.io.IOException
java.io.IOException - if there was an error processing the textpublic void endText()
throws java.io.IOException
java.io.IOException - if there was an error processing the textpublic void showTextString(byte[] string)
throws java.io.IOException
string - the encoded textjava.io.IOException - if there was an error showing the textpublic void showTextStrings(COSArray array) throws java.io.IOException
array - array of encoded text strings and adjustmentsjava.io.IOException - if there was an error showing the textprotected void applyTextAdjustment(float tx,
float ty)
throws java.io.IOException
tx - x-translationty - y-translationjava.io.IOException - if something went wrongprotected void showText(byte[] string)
throws java.io.IOException
string - the encoded textjava.io.IOException - if there is an error processing the stringprotected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, java.lang.String unicode, Vector displacement) throws java.io.IOException
textRenderingMatrix - the current text rendering matrix, Trmfont - the current fontcode - internal PDF character code for the glyphunicode - the Unicode text for this glyph, or null if the PDF does provide itdisplacement - the displacement (i.e. advance) of the glyph in text spacejava.io.IOException - if the glyph cannot be processedprotected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code, java.lang.String unicode, Vector displacement) throws java.io.IOException
textRenderingMatrix - the current text rendering matrix, Trmfont - the current fontcode - internal PDF character code for the glyphunicode - the Unicode text for this glyph, or null if the PDF does provide itdisplacement - the displacement (i.e. advance) of the glyph in text spacejava.io.IOException - if the glyph cannot be processedprotected void showType3Glyph(Matrix textRenderingMatrix, PDType3Font font, int code, java.lang.String unicode, Vector displacement) throws java.io.IOException
textRenderingMatrix - the current text rendering matrix, Trmfont - the current fontcode - internal PDF character code for the glyphunicode - the Unicode text for this glyph, or null if the PDF does provide itdisplacement - the displacement (i.e. advance) of the glyph in text spacejava.io.IOException - if the glyph cannot be processedpublic void processOperator(java.lang.String operation,
java.util.List<COSBase> arguments)
throws java.io.IOException
operation - The operation to perform.arguments - The list of arguments.java.io.IOException - If there is an error processing the operation.protected void processOperator(Operator operator, java.util.List<COSBase> operands) throws java.io.IOException
operator - The operation to perform.operands - The list of arguments.java.io.IOException - If there is an error processing the operation.protected void unsupportedOperator(Operator operator, java.util.List<COSBase> operands) throws java.io.IOException
operator - The unknown operator.operands - The list of operands.java.io.IOException - if something went wrongprotected void operatorException(Operator operator, java.util.List<COSBase> operands, java.io.IOException e) throws java.io.IOException
operator - The unknown operator.operands - The list of operands.e - the thrown exception.java.io.IOException - if something went wrongpublic void saveGraphicsState()
public void restoreGraphicsState()
protected final java.util.Stack<PDGraphicsState> saveGraphicsStack()
protected final void restoreGraphicsStack(java.util.Stack<PDGraphicsState> snapshot)
snapshot - the graphics state stack to be restored.public int getGraphicsStackSize()
public PDGraphicsState getGraphicsState()
public Matrix getTextLineMatrix()
public void setTextLineMatrix(Matrix value)
value - The textLineMatrix to set.public Matrix getTextMatrix()
public void setTextMatrix(Matrix value)
value - The textMatrix to set.public void setLineDashPattern(COSArray array, int phase)
array - dash arrayphase - dash phasepublic PDResources getResources()
public PDPage getCurrentPage()
public Matrix getInitialMatrix()
public java.awt.geom.Point2D.Float transformedPoint(float x,
float y)
x - x-coordinate of the point to be transformed.y - y-coordinate of the point to be transformed.protected float transformWidth(float width)
width - the width value to be transformed.Copyright © 2002–2018. All rights reserved.