Class PdfCanvasParser
Parses the page or form XObject content.
public class PdfCanvasParser
- Inheritance
-
PdfCanvasParser
- Inherited Members
Constructors
PdfCanvasParser(PdfTokenizer)
Creates a new instance of PdfContentParser
public PdfCanvasParser(PdfTokenizer tokeniser)
Parameters
tokeniser
PdfTokenizerthe tokeniser with the content
PdfCanvasParser(PdfTokenizer, PdfResources)
Creates a new instance of PdfContentParser
public PdfCanvasParser(PdfTokenizer tokeniser, PdfResources currentResources)
Parameters
tokeniser
PdfTokenizerthe tokeniser with the content
currentResources
PdfResourcescurrent resources of the content stream. It is optional parameter, which is used for performance improvements of specific cases of inline images parsing.
Methods
GetTokeniser()
Gets the tokeniser.
public virtual PdfTokenizer GetTokeniser()
Returns
- PdfTokenizer
the tokeniser.
NextValidToken()
Reads the next token skipping over the comments.
public virtual bool NextValidToken()
Returns
- bool
true
if a token was read,false
if the end of content was reached
Parse(IList<PdfObject>)
Parses a single command from the content.
public virtual IList<PdfObject> Parse(IList<PdfObject> ls)
Parameters
ls
IList<PdfObject>an
ArrayList
to use. It will be cleared before using. If it'snull
will create a newArrayList
Returns
Remarks
Parses a single command from the content. Each command is output as an array of arguments
having the command itself as the last element. The returned array will be empty if the
end of content was reached.
A specific behaviour occurs when inline image is encountered (BI command):
in that case, parser would continue parsing until it meets EI - end of the inline image;
as a result in this case it will return an array with inline image dictionary and image bytes
encapsulated in PdfStream object as first element and EI command as second element.
ReadArray()
Reads an array.
public virtual PdfArray ReadArray()
Returns
- PdfArray
an array
Remarks
Reads an array. The tokeniser must be positioned past the "[" token.
ReadDictionary()
Reads a dictionary.
public virtual PdfDictionary ReadDictionary()
Returns
- PdfDictionary
the dictionary
Remarks
Reads a dictionary. The tokeniser must be positioned past the "<<" token.
ReadObject()
Reads a pdf object.
public virtual PdfObject ReadObject()
Returns
- PdfObject
the pdf object
SetTokeniser(PdfTokenizer)
Sets the tokeniser.
public virtual void SetTokeniser(PdfTokenizer tokeniser)
Parameters
tokeniser
PdfTokenizerthe tokeniser