iText 9.2.0 API
iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor Class Reference

Processor for a PDF content stream. More...

Classes

class   PopGraphicsStateOperator
  A handler that implements operator (Q). More...
 

Public Member Functions

  PdfCanvasProcessor (IEventListener eventListener)
  Creates a new PDF Content Stream Processor that will send its output to the designated render listener. More...
 
  PdfCanvasProcessor (IEventListener eventListener, IDictionary< String, IContentOperator > additionalContentOperators)
  Creates a new PDF Content Stream Processor that will send its output to the designated render listener. More...
 
virtual IXObjectDoHandler  RegisterXObjectDoHandler (PdfName xobjectSubType, IXObjectDoHandler handler)
  Registers a Do handler that will be called when Do for the provided XObject subtype is encountered during content processing. More...
 
virtual IContentOperator  RegisterContentOperator (String operatorString, IContentOperator @operator)
  Registers a content operator that will be called when the specified operator string is encountered during content processing. More...
 
virtual ICollection< String >  GetRegisteredOperatorStrings ()
  Gets the System.Collections.ICollection containing all the registered operators strings. More...
 
virtual void  Reset ()
  Resets the graphics state stack, matrices and resources. More...
 
virtual ParserGraphicsState  GetGraphicsState ()
  Gets the current ParserGraphicsState More...
 
virtual void  ProcessContent (byte[] contentBytes, PdfResources resources)
  Processes PDF syntax. More...
 
virtual void  ProcessPageContent (PdfPage page)
  Processes PDF syntax. More...
 
virtual IEventListener  GetEventListener ()
  Accessor method for the iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener object maintained in this class. More...
 

Static Public Attributes

const String  DEFAULT_OPERATOR = "DefaultOperator"
 

Package Functions

virtual void  PopulateOperators ()
  Loads all the supported graphics and text state operators in a map. More...
 
virtual void  PaintPath (int operation, int rule)
  Displays the current path. More...
 
virtual void  InvokeOperator (PdfLiteral @operator, IList< PdfObject > operands)
  Invokes an operator. More...
 
virtual PdfStream  GetXObjectStream (PdfName xobjectName)
 
virtual PdfResources  GetResources ()
 
virtual void  PopulateXObjectDoHandlers ()
 
virtual PdfFont  GetFont (PdfDictionary fontDict)
  Creates a iText.Kernel.Font.PdfFont object by a font dictionary. More...
 
virtual void  BeginMarkedContent (PdfName tag, PdfDictionary dict)
  Add to the marked content stack More...
 
virtual void  EndMarkedContent ()
  Remove the latest marked content from the stack. More...
 
virtual void  EventOccurred (IEventData data, EventType type)
  This is a proxy to pass only those events to the event listener which are supported by it. More...
 

Package Attributes

readonly IEventListener  eventListener
  Listener that will be notified of render events More...
 
readonly ICollection< EventType supportedEvents
  Cache supported events in case the user's iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener.GetSupportedEvents() method is not very efficient More...
 
Path  currentPath = new Path()
 
bool  isClip
  Indicates whether the current clipping path should be modified by intersecting it with the current path. More...
 
int  clippingRule
  Specifies the filling rule which should be applied while calculating new clipping path. More...
 

Detailed Description

Processor for a PDF content stream.

Constructor & Destructor Documentation

◆ PdfCanvasProcessor() [1/2]

iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.PdfCanvasProcessor ( IEventListener  eventListener )
inline

Creates a new PDF Content Stream Processor that will send its output to the designated render listener.

Parameters
eventListener the iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener that will receive rendering notifications

◆ PdfCanvasProcessor() [2/2]

iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.PdfCanvasProcessor ( IEventListener  eventListener,
IDictionary< String, IContentOperator additionalContentOperators 
)
inline

Creates a new PDF Content Stream Processor that will send its output to the designated render listener.

Creates a new PDF Content Stream Processor that will send its output to the designated render listener. Also allows registration of custom IContentOperators that can influence how (and whether or not) the PDF instructions will be parsed.

Parameters
eventListener the iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener that will receive rendering notifications
additionalContentOperators an optional map of custom IContentOperator s for rendering instructions

Member Function Documentation

◆ BeginMarkedContent()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.BeginMarkedContent ( PdfName  tag,
PdfDictionary  dict 
)
inlinepackagevirtual

Add to the marked content stack

Parameters
tag the tag of the marked content
dict the PdfDictionary associated with the marked content

◆ EndMarkedContent()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.EndMarkedContent ( )
inlinepackagevirtual

Remove the latest marked content from the stack.

Remove the latest marked content from the stack. Keeps track of the BMC, BDC and EMC operators.

◆ EventOccurred()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.EventOccurred ( IEventData  data,
EventType  type 
)
inlinepackagevirtual

This is a proxy to pass only those events to the event listener which are supported by it.

Parameters
data event data
type event type

◆ GetEventListener()

virtual IEventListener iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.GetEventListener ( )
inlinevirtual

Accessor method for the iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener object maintained in this class.

Accessor method for the iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener object maintained in this class. Necessary for implementing custom ContentOperator implementations.

Returns
the renderListener

◆ GetFont()

virtual PdfFont iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.GetFont ( PdfDictionary  fontDict )
inlinepackagevirtual

Creates a iText.Kernel.Font.PdfFont object by a font dictionary.

Creates a iText.Kernel.Font.PdfFont object by a font dictionary. The font may have been cached in case it is an indirect object.

Parameters
fontDict the font dictionary to create the font from
Returns
the created font

◆ GetGraphicsState()

virtual ParserGraphicsState iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.GetGraphicsState ( )
inlinevirtual

Gets the current ParserGraphicsState

Returns
the current ParserGraphicsState

◆ GetRegisteredOperatorStrings()

virtual ICollection iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.GetRegisteredOperatorStrings ( )
inlinevirtual

Gets the System.Collections.ICollection containing all the registered operators strings.

Returns

System.Collections.ICollection containing all the registered operators strings.

◆ InvokeOperator()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.InvokeOperator ( PdfLiteral operator,
IList< PdfObject operands 
)
inlinepackagevirtual

Invokes an operator.

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

◆ PaintPath()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.PaintPath ( int  operation,
int  rule 
)
inlinepackagevirtual

◆ PopulateOperators()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.PopulateOperators ( )
inlinepackagevirtual

Loads all the supported graphics and text state operators in a map.

◆ ProcessContent()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.ProcessContent ( byte[]  contentBytes,
PdfResources  resources 
)
inlinevirtual

Processes PDF syntax.

Processes PDF syntax. Note: If you re-use a given PdfCanvasProcessor , you must call Reset()

Parameters
contentBytes the bytes of a content stream
resources the resources of the content stream. Must not be null.

◆ ProcessPageContent()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.ProcessPageContent ( PdfPage  page )
inlinevirtual

Processes PDF syntax.

Processes PDF syntax. Note: If you re-use a given PdfCanvasProcessor , you must call Reset()

Parameters
page the page to process

◆ RegisterContentOperator()

virtual IContentOperator iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.RegisterContentOperator ( String  operatorString,
IContentOperator operator 
)
inlinevirtual

Registers a content operator that will be called when the specified operator string is encountered during content processing.

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 DEFAULT_OPERATOR for a catch-all operator
operator the operator that will receive notification when the operator is encountered
Returns
the existing registered operator, if any

◆ RegisterXObjectDoHandler()

virtual IXObjectDoHandler iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.RegisterXObjectDoHandler ( PdfName  xobjectSubType,
IXObjectDoHandler  handler 
)
inlinevirtual

Registers a Do handler that will be called when Do for the provided XObject subtype is encountered during content processing.

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 handler
handler the handler that will receive notification when the Do operator for the specified subtype is encountered
Returns
the existing registered handler, if any

◆ Reset()

virtual void iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.Reset ( )
inlinevirtual

Resets the graphics state stack, matrices and resources.

Member Data Documentation

◆ clippingRule

int iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.clippingRule
package

Specifies the filling rule which should be applied while calculating new clipping path.

◆ eventListener

readonly IEventListener iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.eventListener
package

Listener that will be notified of render events

◆ isClip

bool iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.isClip
package

Indicates whether the current clipping path should be modified by intersecting it with the current path.

◆ supportedEvents

readonly ICollection<EventType> iText.Kernel.Pdf.Canvas.Parser.PdfCanvasProcessor.supportedEvents
package

Cache supported events in case the user's iText.Kernel.Pdf.Canvas.Parser.Listener.IEventListener.GetSupportedEvents() method is not very efficient