|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.util.PDFStreamEngine
public class PDFStreamEngine
This class will run through a PDF content stream and execute certain operations and provide a callback interface for clients that want to do things with the stream. See the PDFTextStripper class for an example of how to use this class.
Constructor Summary | |
---|---|
PDFStreamEngine()
Constructor. |
|
PDFStreamEngine(Properties properties)
Constructor with engine properties. |
Method Summary | |
---|---|
Map<String,PDColorSpace> |
getColorSpaces()
|
PDPage |
getCurrentPage()
Get the current page that is being processed. |
Map<String,PDFont> |
getFonts()
|
Stack<PDGraphicsState> |
getGraphicsStack()
|
PDGraphicsState |
getGraphicsState()
|
Map<String,PDExtendedGraphicsState> |
getGraphicsStates()
|
PDResources |
getResources()
|
Matrix |
getTextLineMatrix()
|
Matrix |
getTextMatrix()
|
int |
getTotalCharCnt()
Get the total number of characters in the doc (including ones that could not be mapped). |
int |
getValidCharCnt()
Get the total number of valid characters in the doc that could be decoded in processEncodedText(). |
Map<String,PDXObject> |
getXObjects()
|
protected String |
inspectFontEncoding(String str)
A method provided as an event interface to allow a subclass to perform some specific functionality on the string encoded by a glyph. |
boolean |
isForceParsing()
Indicates if force parsing is activated. |
void |
processEncodedText(byte[] string)
Process encoded text from the PDF Stream. |
protected void |
processOperator(PDFOperator operator,
List<COSBase> arguments)
This is used to handle an operation. |
void |
processOperator(String operation,
List<COSBase> arguments)
This is used to handle an operation. |
void |
processStream(PDPage aPage,
PDResources resources,
COSStream cosStream)
This will process the contents of the stream. |
void |
processSubStream(PDPage aPage,
PDResources resources,
COSStream cosStream)
Process a sub stream of the current stream. |
protected void |
processTextPosition(TextPosition text)
A method provided as an event interface to allow a subclass to perform some specific functionality when text needs to be processed. |
void |
registerOperatorProcessor(String operator,
OperatorProcessor op)
Register a custom operator processor with the engine. |
void |
resetEngine()
This method must be called between processing documents. |
void |
setColorSpaces(Map<String,PDColorSpace> value)
|
void |
setFonts(Map<String,PDFont> value)
|
void |
setForceParsing(boolean forceParsingValue)
Enable/Disable force parsing. |
void |
setGraphicsStack(Stack<PDGraphicsState> value)
|
void |
setGraphicsState(PDGraphicsState value)
|
void |
setGraphicsStates(Map<String,PDExtendedGraphicsState> value)
|
void |
setTextLineMatrix(Matrix value)
|
void |
setTextMatrix(Matrix value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PDFStreamEngine()
public PDFStreamEngine(Properties properties) throws IOException
properties
- The engine properties.
IOException
- If there is an error setting the engine properties.Method Detail |
---|
public boolean isForceParsing()
public void setForceParsing(boolean forceParsingValue)
forceParsingValue
- true activates force parsingpublic void registerOperatorProcessor(String operator, OperatorProcessor op)
operator
- The operator as a string.op
- Processor instance.public void resetEngine()
public void processStream(PDPage aPage, PDResources resources, COSStream cosStream) throws IOException
aPage
- The page.resources
- The location to retrieve resources.cosStream
- the Stream to execute.
IOException
- if there is an error accessing the stream.public void processSubStream(PDPage aPage, PDResources resources, COSStream cosStream) throws IOException
aPage
- The page used for drawing.resources
- The resources used when processing the stream.cosStream
- The stream to process.
IOException
- If there is an exception while processing the stream.protected void processTextPosition(TextPosition text)
text
- The text to be processed.protected String inspectFontEncoding(String str)
str
- The string to be processed.public void processEncodedText(byte[] string) throws IOException
string
- The encoded text
IOException
- If there is an error processing the stringpublic void processOperator(String operation, List<COSBase> arguments) throws IOException
operation
- The operation to perform.arguments
- The list of arguments.
IOException
- If there is an error processing the operation.protected void processOperator(PDFOperator operator, List<COSBase> arguments) throws IOException
operator
- The operation to perform.arguments
- The list of arguments.
IOException
- If there is an error processing the operation.public Map<String,PDColorSpace> getColorSpaces()
public Map<String,PDXObject> getXObjects()
public void setColorSpaces(Map<String,PDColorSpace> value)
value
- The colorSpaces to set.public Map<String,PDFont> getFonts()
public void setFonts(Map<String,PDFont> value)
value
- The fonts to set.public Stack<PDGraphicsState> getGraphicsStack()
public void setGraphicsStack(Stack<PDGraphicsState> value)
value
- The graphicsStack to set.public PDGraphicsState getGraphicsState()
public void setGraphicsState(PDGraphicsState value)
value
- The graphicsState to set.public Map<String,PDExtendedGraphicsState> getGraphicsStates()
public void setGraphicsStates(Map<String,PDExtendedGraphicsState> value)
value
- The graphicsStates to set.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 PDResources getResources()
public PDPage getCurrentPage()
public int getValidCharCnt()
public int getTotalCharCnt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |