Package com.itextpdf.text.pdf.parser
Class PdfContentStreamProcessor
- java.lang.Object
-
- com.itextpdf.text.pdf.parser.PdfContentStreamProcessor
-
public class PdfContentStreamProcessor extends java.lang.ObjectProcessor for a PDF content Stream.- Since:
- 2.1.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULTOPERATORDefault operator
-
Constructor Summary
Constructors Constructor Description PdfContentStreamProcessor(RenderListener renderListener)Creates a new PDF Content Stream Processor that will send it's output to the designated render listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.lang.String>getRegisteredOperatorStrings()RenderListenergetRenderListener()Accessor method for the RenderListener object maintained in this class.GraphicsStategs()Returns the current graphics state.protected voidhandleInlineImage(InlineImageInfo info, PdfDictionary colorSpaceDic)Callback when an inline image is found.voidprocessContent(byte[] contentBytes, PdfDictionary resources)Processes PDF syntax.ContentOperatorregisterContentOperator(java.lang.String operatorString, ContentOperator operator)Registers a content operator that will be called when the specified operator string is encountered during content processing.XObjectDoHandlerregisterXObjectDoHandler(PdfName xobjectSubType, XObjectDoHandler handler)Registers a Do handler that will be called when Do for the provided XObject subtype is encountered during content processing.voidreset()Resets the graphics state stack, matrices and resources.
-
-
-
Field Detail
-
DEFAULTOPERATOR
public static final java.lang.String DEFAULTOPERATOR
Default operator- Since:
- 5.0.1
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdfContentStreamProcessor
public PdfContentStreamProcessor(RenderListener renderListener)
Creates a new PDF Content Stream Processor that will send it's output to the designated render listener.- Parameters:
renderListener- theRenderListenerthat will receive rendering notifications
-
-
Method Detail
-
registerXObjectDoHandler
public XObjectDoHandler registerXObjectDoHandler(PdfName xobjectSubType, XObjectDoHandler handler)
Registers a Do handler that will be called when Do for the provided XObject subtype is encountered during content processing.
If you register a handler, it is a very good idea to pass the call on to the existing registered handler (returned by this call), otherwise you may inadvertently change the internal behavior of the processor.- Parameters:
xobjectSubType- the XObject subtype this handler will process, or PdfName.DEFAULT for a catch-all handlerhandler- the handler that will receive notification when the Do operator for the specified subtype is encountered- Returns:
- the existing registered handler, if any
- Since:
- 5.0.1
-
registerContentOperator
public ContentOperator registerContentOperator(java.lang.String operatorString, ContentOperator operator)
Registers a content operator that will be called when the specified operator string is encountered during content processing.
If you register an operator, it is a very good idea to pass the call on to the existing registered operator (returned by this call), otherwise you may inadvertently change the internal behavior of the processor.- Parameters:
operatorString- the operator id, or DEFAULTOPERATOR for a catch-all operatoroperator- the operator that will receive notification when the operator is encountered- Returns:
- the existing registered operator, if any
- Since:
- 2.1.7
-
getRegisteredOperatorStrings
public java.util.Collection<java.lang.String> getRegisteredOperatorStrings()
- Returns:
Collectioncontaining all the registered operators strings- Since:
- 5.5.6
-
reset
public void reset()
Resets the graphics state stack, matrices and resources.
-
gs
public GraphicsState gs()
Returns the current graphics state.- Returns:
- the graphics state
-
processContent
public void processContent(byte[] contentBytes, PdfDictionary resources)Processes PDF syntax. Note: If you re-use a givenPdfContentStreamProcessor, you must callreset()- Parameters:
contentBytes- the bytes of a content streamresources- the resources that come with the content stream
-
handleInlineImage
protected void handleInlineImage(InlineImageInfo info, PdfDictionary colorSpaceDic)
Callback when an inline image is found. This requires special handling because inline images don't follow the standard operator syntax- Parameters:
info- the inline imagecolorSpaceDic- the color space for the inline immage
-
getRenderListener
public RenderListener getRenderListener()
Accessor method for the RenderListener object maintained in this class. Necessary for implementing custom ContentOperator implementations.- Returns:
- the renderListener
-
-