Class TextHandler
- Namespace
- iTextSharp.text.xml
- Assembly
- iTextSharp.LGPLv2.Core.dll
The iTextHandler -class maps several XHTML-tags to iText-objects.
public class TextHandler : ParserBase
- Inheritance
-
TextHandler
- Derived
- Inherited Members
Constructors
TextHandler(IDocListener)
Constructs a new iTextHandler that will translate all the events triggered by the parser to actions on the Document -object.
public TextHandler(IDocListener document)
Parameters
document
IDocListenerthis is the document on which events must be triggered
TextHandler(IDocListener, NullValueDictionary<string, XmlPeer>)
@throws DocumentException @throws IOException
public TextHandler(IDocListener document, NullValueDictionary<string, XmlPeer> myTags)
Parameters
document
IDocListenermyTags
NullValueDictionary<string, XmlPeer>
TextHandler(IDocListener, TagMap)
@throws DocumentException @throws IOException
public TextHandler(IDocListener document, TagMap myTags)
Parameters
document
IDocListenermyTags
TagMap
TextHandler(IDocListener, TagMap, BaseFont)
@throws DocumentException @throws IOException
public TextHandler(IDocListener document, TagMap myTags, BaseFont bf)
Parameters
document
IDocListenermyTags
TagMapbf
BaseFont
Fields
Chapters
Counts the number of chapters in this document.
protected int Chapters
Field Value
ControlOpenClose
This is a flag that can be set, if you want to open and close the Document-object yourself.
protected bool ControlOpenClose
Field Value
CurrentChunk
This is the current chunk to which characters can be added.
protected Chunk CurrentChunk
Field Value
Document
This is the resulting document.
protected IDocListener Document
Field Value
Ignore
This is the current chunk to which characters can be added.
protected bool Ignore
Field Value
MyTags
protected NullValueDictionary<string, XmlPeer> MyTags
Field Value
Stack
This is a Stack of objects, waiting to be added to the document.
protected Stack<IElement> Stack
Field Value
Properties
DefaultFont
public BaseFont DefaultFont { get; set; }
Property Value
Methods
AddImage(Image)
protected void AddImage(Image img)
Parameters
img
Image
Characters(string, int, int)
This method gets called when characters are encountered.
public override void Characters(string content, int start, int length)
Parameters
content
stringan array of characters
start
intthe start position in the array
length
intthe number of characters to read from the array
EndElement(string, string, string)
This method gets called when an end tag is encountered.
public override void EndElement(string uri, string lname, string name)
Parameters
HandleEndingTags(string)
This method deals with the starting tags.
public void HandleEndingTags(string name)
Parameters
name
stringthe name of the tag
HandleStartingTags(string, Properties)
This method deals with the starting tags.
public void HandleStartingTags(string name, Properties attributes)
Parameters
name
stringthe name of the tag
attributes
Propertiesthe list of attributes
IgnorableWhitespace(char[], int, int)
This method gets called when ignorable white space encountered.
public static void IgnorableWhitespace(char[] ch, int start, int length)
Parameters
ch
char[]an array of characters
start
intthe start position in the array
length
intthe number of characters to read from the array
IsDocumentRoot(string)
Checks if a certain tag corresponds with the roottag.
protected static bool IsDocumentRoot(string tag)
Parameters
tag
stringa presumed tagname
Returns
- bool
true if tag equals itext , false otherwise.
SetControlOpenClose(bool)
Sets the parameter that allows you to enable/disable the control over the Document.Open() and Document.Close() method.
public void SetControlOpenClose(bool controlOpenClose)
Parameters
controlOpenClose
boolset this to false if you plan to open/close the Document yourself
Remarks
If you set this parameter to true (= default), the parser will open the Document object when the start-root-tag is encountered and close it when the end-root-tag is met. If you set it to false, you have to open and close the Document object yourself.
StartElement(string, string, string, INullValueDictionary<string, string>)
This method gets called when a start tag is encountered.
public override void StartElement(string uri, string lname, string name, INullValueDictionary<string, string> attrs)