Package com.aowagie.text.pdf.parser
Class PdfContentStreamProcessor
java.lang.Object
com.aowagie.text.pdf.parser.PdfContentStreamProcessor
- Direct Known Subclasses:
SimpleTextExtractingPdfContentStreamProcessor
Processor for a PDF content Stream.
- Since:
- 2.1.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA content operator implementation (BT).private static classA content operator implementation (ET).private static classA content operator implementation (cm).private static classA content operator implementation (').private static classA content operator implementation (").private static classA content operator implementation (Q).private static classA content operator implementation (gs).private static classA content operator implementation (q).private static classA content operator implementation (Tc).private static classA content operator implementation (Tf).private static classA content operator implementation (Tz).private static classA content operator implementation (TL).private static classA content operator implementation (Tr).private static classA content operator implementation (Ts).private static classA content operator implementation (Tw).private static classA content operator implementation (Tj).private static classA content operator implementation (TJ).private static classA content operator implementation (T*).private static classA content operator implementation (Td).private static classA content operator implementation (TD).private static classA content operator implementation (Tm). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StackStack keeping track of the graphics state.private MapA map with all supported operators operators (PDF syntax).private PdfDictionaryResources for the content stream.private MatrixText line matrix.private MatrixText matrix. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringDecodes a PdfString (which will contain glyph ids encoded in the font's encoding) based on the active font, and determine the unicode equivalentprivate voiddisplayPdfString(PdfString string, float tj) Displays text.abstract voiddisplayText(String text, Matrix nextTextMatrix) Displays text.Returns the current line matrix.Returns the current text matrix.private floatgetStringWidth(String string, float tj) Gets the width of a String.gs()Returns the current graphics state.private voidinvokeOperator(PdfLiteral operator, ArrayList operands) Invokes an operator.private voidLoads all the supported graphics and text state operators in a map.voidprocessContent(byte[] contentBytes, PdfDictionary resources) Processes PDF syntaxvoidreset()Resets the graphics state stack, matrices and resources.
-
Field Details
-
operators
A map with all supported operators operators (PDF syntax). -
resources
Resources for the content stream. -
gsStack
Stack keeping track of the graphics state. -
textMatrix
Text matrix. -
textLineMatrix
Text line matrix.
-
-
Constructor Details
-
PdfContentStreamProcessor
public PdfContentStreamProcessor()Creates a new PDF Content Stream Processor.
-
-
Method Details
-
populateOperators
private void populateOperators()Loads all the supported graphics and text state operators in a map. -
reset
public void reset()Resets the graphics state stack, matrices and resources. -
gs
Returns the current graphics state.- Returns:
- the graphics state
-
getCurrentTextMatrix
Returns the current text matrix.- Returns:
- the text matrix
- Since:
- 2.1.5
-
getCurrentTextLineMatrix
Returns the current line matrix.- Returns:
- the line matrix
- Since:
- 2.1.5
-
invokeOperator
Invokes an operator.- Parameters:
operator- the PDF Syntax of the operatoroperands- a list with operands
-
decode
Decodes a PdfString (which will contain glyph ids encoded in the font's encoding) based on the active font, and determine the unicode equivalent- Parameters:
in- the String that needs to be encoded- Returns:
- the encoded String
- Since:
- 2.1.7
-
displayText
Displays text.- Parameters:
text- the text that needs to be displayednextTextMatrix- a text matrix
-
getStringWidth
Gets the width of a String.- Parameters:
string- the string that needs measuringtj- text adjustment- Returns:
- the width of a String
-
displayPdfString
Displays text.- Parameters:
string- the text to displaytj- the text adjustment
-
processContent
Processes PDF syntax- Parameters:
contentBytes- the bytes of a content streamresources- the resources that come with the content stream
-