public class PdfCanvasProcessor extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
PdfCanvasProcessor.PopGraphicsStateOperator
A content operator implementation (Q).
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
clippingRule
Specifies the filling rule which should be applied while calculating
new clipping path.
|
protected Path |
currentPath |
static String |
DEFAULT_OPERATOR |
protected IEventListener |
eventListener
Listener that will be notified of render events
|
protected boolean |
isClip
Indicates whether the current clipping path should be modified by
intersecting it with the current path.
|
protected Set<EventType> |
supportedEvents
Cache supported events in case the user's
IEventListener.getSupportedEvents() method is not very efficient |
| Constructor and Description |
|---|
PdfCanvasProcessor(IEventListener eventListener)
Creates a new PDF Content Stream Processor that will send it's output to the
designated render listener.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
beginMarkedContent(PdfName tag,
PdfDictionary dict)
Add to the marked content stack
|
protected void |
endMarkedContent()
Remove the latest marked content from the stack.
|
IEventListener |
getEventListener()
Accessor method for the
IEventListener object maintained in this class. |
protected PdfFont |
getFont(PdfDictionary fontDict)
Gets the font pointed to by the indirect reference.
|
ParserGraphicsState |
getGraphicsState() |
Collection<String> |
getRegisteredOperatorStrings() |
protected PdfResources |
getResources() |
protected PdfStream |
getXObjectStream(PdfName xobjectName) |
protected void |
invokeOperator(PdfLiteral operator,
List<PdfObject> operands)
Invokes an operator.
|
protected void |
paintPath(int operation,
int rule)
Displays the current path.
|
protected void |
populateOperators()
Loads all the supported graphics and text state operators in a map.
|
protected void |
populateXObjectDoHandlers() |
void |
processContent(byte[] contentBytes,
PdfResources resources)
Processes PDF syntax.
|
void |
processPageContent(PdfPage page)
Processes PDF syntax.
|
IContentOperator |
registerContentOperator(String operatorString,
IContentOperator operator)
Registers a content operator that will be called when the specified operator string is encountered during content processing.
|
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.
|
void |
reset()
Resets the graphics state stack, matrices and resources.
|
public static final String DEFAULT_OPERATOR
protected final IEventListener eventListener
protected final Set<EventType> supportedEvents
IEventListener.getSupportedEvents() method is not very efficientprotected Path currentPath
protected boolean isClip
protected int clippingRule
public PdfCanvasProcessor(IEventListener eventListener)
eventListener - the IEventListener that will receive rendering notificationspublic IXObjectDoHandler registerXObjectDoHandler(PdfName xobjectSubType, IXObjectDoHandler handler)
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 encounteredpublic IContentOperator registerContentOperator(String operatorString, IContentOperator operator)
operatorString - the operator id, or DEFAULT_OPERATOR for a catch-all operatoroperator - the operator that will receive notification when the operator is encounteredpublic Collection<String> getRegisteredOperatorStrings()
Collection containing all the registered operators stringspublic void reset()
public ParserGraphicsState getGraphicsState()
public void processContent(byte[] contentBytes,
PdfResources resources)
PdfCanvasProcessor, you must call reset()contentBytes - the bytes of a content streamresources - the resources of the content stream. Must not be null.public void processPageContent(PdfPage page)
page - the page to processpublic IEventListener getEventListener()
IEventListener object maintained in this class.
Necessary for implementing custom ContentOperator implementations.protected void populateOperators()
protected void paintPath(int operation,
int rule)
operation - One of the possible combinations of PathRenderInfo.STROKE
and PathRenderInfo.FILL values or
PathRenderInfo.NO_OPrule - Either PdfCanvasConstants.FillingRule#NONZERO_WINDING or PdfCanvasConstants.FillingRule#EVEN_ODD
In case it isn't applicable pass any byte value.protected void invokeOperator(PdfLiteral operator, List<PdfObject> operands)
operator - the PDF Syntax of the operatoroperands - a list with operandsprotected PdfResources getResources()
protected void populateXObjectDoHandlers()
protected PdfFont getFont(PdfDictionary fontDict)
fontDict - protected void beginMarkedContent(PdfName tag, PdfDictionary dict)
tag - the tag of the marked contentdict - the PdfDictionary associated with the marked contentprotected void endMarkedContent()
Copyright © 1998–2016 iText Group NV. All rights reserved.