Class PdfContentStreamHandler

java.lang.Object
com.lowagie.text.pdf.parser.PdfContentStreamHandler

public class PdfContentStreamHandler extends Object
  • Field Details

    • textFragmentStreams

      private final Stack<List<TextAssemblyBuffer>> textFragmentStreams
    • contextNames

      private final Stack<String> contextNames
    • renderListener

      private final TextAssembler renderListener
      detail parser for text within a marked section. used by TextAssembler
    • operators

      private Map<String,ContentOperator> operators
      A map with all supported operators operators (PDF syntax).
    • gsStack

      private Stack<GraphicsState> gsStack
      Stack keeping track of the graphics state.
    • textMatrix

      private Matrix textMatrix
      Text matrix.
    • textLineMatrix

      private Matrix textLineMatrix
      Text line matrix.
    • textFragments

      private List<TextAssemblyBuffer> textFragments
  • Constructor Details

    • PdfContentStreamHandler

      public PdfContentStreamHandler(TextAssembler renderListener)
  • Method Details

    • getMatrix

      private static Matrix getMatrix(List<PdfObject> operands)
    • registerContentOperator

      public void registerContentOperator(ContentOperator operator)
      Registers a content operator that will be called when the specified operator string is encountered during content processing. Each operator may be registered only once (it is not legal to have multiple operators with the same operatorString)
      Parameters:
      operator - the operator that will receive notification when the operator is encountered
      Since:
      2.1.7
    • installDefaultOperators

      protected void installDefaultOperators()
      Loads all the supported graphics and text state operators in a map.
    • lookupOperator

      public Optional<ContentOperator> lookupOperator(String operatorName)
      Get the operator to process a command with a given name
      Parameters:
      operatorName - name of the operator that we might need to call
      Returns:
      the operator or null if none present
    • invokeOperator

      public void invokeOperator(PdfLiteral operator, List<PdfObject> operands, PdfDictionary resources)
      Invokes an operator.
      Parameters:
      operator - the PDF Syntax of the operator
      operands - a list with operands
      resources - Pdf Resources found in the file containing the stream.
    • popContext

      void popContext()
    • pushContext

      void pushContext(String newContextName)
    • graphicsState

      GraphicsState graphicsState()
      Returns the current graphics state.
      Returns:
      the graphics state
    • reset

      public void reset()
    • getCurrentTextMatrix

      protected Matrix getCurrentTextMatrix()
      Returns the current text matrix.
      Returns:
      the text matrix
      Since:
      2.1.5
    • getCurrentTextLineMatrix

      protected Matrix getCurrentTextLineMatrix()
      Returns the current line matrix.
      Returns:
      the line matrix
      Since:
      2.1.5
    • applyTextAdjust

      void applyTextAdjust(float tj)
      Adjusts the text matrix for the specified adjustment value (see TJ operator in the PDF spec for information)
      Parameters:
      tj - the text adjustment
    • getCurrentFont

      public CMapAwareDocumentFont getCurrentFont()
      Returns:
      current font in processing state
    • displayPdfString

      void displayPdfString(PdfString string)
      Displays text.
      Parameters:
      string - the text to display
    • getResultantText

      public String getResultantText()
      Returns:
      result text