com.lowagie.text.pdf.parser

Class PdfContentStreamProcessor

public abstract class PdfContentStreamProcessor extends Object

Processor for a PDF content Stream.

Since: 2.1.4

Nested Class Summary
static classPdfContentStreamProcessor.BeginText
A content operator implementation (BT).
static classPdfContentStreamProcessor.EndText
A content operator implementation (ET).
static classPdfContentStreamProcessor.ModifyCurrentTransformationMatrix
A content operator implementation (cm).
static classPdfContentStreamProcessor.MoveNextLineAndShowText
A content operator implementation (').
static classPdfContentStreamProcessor.MoveNextLineAndShowTextWithSpacing
A content operator implementation (").
static classPdfContentStreamProcessor.PopGraphicsState
A content operator implementation (Q).
static classPdfContentStreamProcessor.ProcessGraphicsStateResource
A content operator implementation (gs).
static classPdfContentStreamProcessor.PushGraphicsState
A content operator implementation (q).
static classPdfContentStreamProcessor.SetTextCharacterSpacing
A content operator implementation (Tc).
static classPdfContentStreamProcessor.SetTextFont
A content operator implementation (Tf).
static classPdfContentStreamProcessor.SetTextHorizontalScaling
A content operator implementation (Tz).
static classPdfContentStreamProcessor.SetTextLeading
A content operator implementation (TL).
static classPdfContentStreamProcessor.SetTextRenderMode
A content operator implementation (Tr).
static classPdfContentStreamProcessor.SetTextRise
A content operator implementation (Ts).
static classPdfContentStreamProcessor.SetTextWordSpacing
A content operator implementation (Tw).
static classPdfContentStreamProcessor.ShowText
A content operator implementation (Tj).
static classPdfContentStreamProcessor.ShowTextArray
A content operator implementation (TJ).
static classPdfContentStreamProcessor.TextMoveNextLine
A content operator implementation (T*).
static classPdfContentStreamProcessor.TextMoveStartNextLine
A content operator implementation (Td).
static classPdfContentStreamProcessor.TextMoveStartNextLineWithLeading
A content operator implementation (TD).
static classPdfContentStreamProcessor.TextSetTextMatrix
A content operator implementation (Tm).
Field Summary
StackgsStack
Stack keeping track of the graphics state.
Mapoperators
A map with all supported operators operators (PDF syntax).
PdfDictionaryresources
Resources for the content stream.
MatrixtextLineMatrix
Text line matrix.
MatrixtextMatrix
Text matrix.
Constructor Summary
PdfContentStreamProcessor()
Creates a new PDF Content Stream Processor.
Method Summary
voiddisplayPdfString(PdfString string, float tj)
Displays text.
abstract voiddisplayText(String text, Matrix nextTextMatrix)
Displays text.
Stringencode(String in)
Encodes a String based on the active font.
MatrixgetCurrentTextLineMatrix()
Returns the current line matrix.
MatrixgetCurrentTextMatrix()
Returns the current text matrix.
floatgetStringWidth(String string, float tj)
Gets the width of a String.
GraphicsStategs()
Returns the current graphics state.
voidinvokeOperator(PdfLiteral operator, ArrayList operands)
Invokes an operator.
voidpopulateOperators()
Loads all the supported graphics and text state operators in a map.
voidprocessContent(byte[] contentBytes, PdfDictionary resources)
Processes PDF syntax
voidreset()
Resets the graphics state stack, matrices and resources.

Field Detail

gsStack

private Stack gsStack
Stack keeping track of the graphics state.

operators

private Map operators
A map with all supported operators operators (PDF syntax).

resources

private PdfDictionary resources
Resources for the content stream.

textLineMatrix

private Matrix textLineMatrix
Text line matrix.

textMatrix

private Matrix textMatrix
Text matrix.

Constructor Detail

PdfContentStreamProcessor

public PdfContentStreamProcessor()
Creates a new PDF Content Stream Processor.

Method Detail

displayPdfString

public void displayPdfString(PdfString string, float tj)
Displays text.

Parameters: string the text to display tj the text adjustment

displayText

public abstract void displayText(String text, Matrix nextTextMatrix)
Displays text.

Parameters: text the text that needs to be displayed nextTextMatrix a text matrix

encode

private String encode(String in)
Encodes a String based on the active font.

Parameters: in the String that needs to be encoded

Returns: the encoded String

getCurrentTextLineMatrix

public Matrix getCurrentTextLineMatrix()
Returns the current line matrix.

Returns: the line matrix

Since: 2.1.5

getCurrentTextMatrix

public Matrix getCurrentTextMatrix()
Returns the current text matrix.

Returns: the text matrix

Since: 2.1.5

getStringWidth

public float getStringWidth(String string, float tj)
Gets the width of a String.

Parameters: string the string that needs measuring tj text adjustment

Returns: the width of a String

gs

public GraphicsState gs()
Returns the current graphics state.

Returns: the graphics state

invokeOperator

public void invokeOperator(PdfLiteral operator, ArrayList operands)
Invokes an operator.

Parameters: operator the PDF Syntax of the operator operands a list with operands

populateOperators

private void populateOperators()
Loads all the supported graphics and text state operators in a map.

processContent

public void processContent(byte[] contentBytes, PdfDictionary resources)
Processes PDF syntax

Parameters: contentBytes the bytes of a content stream resources the resources that come with the content stream

reset

public void reset()
Resets the graphics state stack, matrices and resources.