Click or drag to resize

ElementGetCharIterator Method

Gets the Char iterator.

Namespace:  pdftron.PDF
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public CharIterator GetCharIterator()

Return Value

Type: CharIterator
a CharIterator addressing the first CharData element in the text run. CharIterator points to CharData. CharData is a data structure that contains the char_code number (used to retrieve glyph outlines, to map to Unicode, etc.), Character positioning information (x, y), and the number of bytes taken by the Character within the text buffer.
Remarks
CharIterator follows the standard STL forward-iterator interface.
Examples
An example of how to use CharIterator.
for (CharIterator itr = element.GetCharIterator(); itr.HasNext(); itr.Next()) {
unsigned int char_code = itr.Current().char_code;
double char_pos_x = itr.Current().x;
double char_pos_y = itr.Current().y;
}
Character positioning information (x, y) is represented in text space. In order to get the positioning in the user space, the returned value should be scaled using the text matrix (GetTextMatrix()) and the current transformation matrix (GetCTM()). See section 4.2 'Other Coordinate Spaces' in PDF Reference Manual for details and PDFNet FAQ - "How do I get absolute/relative text and Character positioning?". whithin a text run a Character may occupy more than a single byte (e.g. in case of composite/Type0 fonts). The role of CharIterator/CharData is to provide a uniform and easy to use inteface to access Character information.
See Also