Click or drag to resize

ElementReader Class

ElementReader can be used to parse and process content streams. ElementReader provides a convenient interface used to traverse the Element display list of a page. The display list representing graphical elements (such as text-runs, paths, images, shadings, forms, etc) is accessed using the intrinsic iterator. ElementReader automatically concatenates page contents spanning multiple streams and provides a mechanism to parse contents of sub-display lists (e.g. forms XObjects and Type3 fonts).
Inheritance Hierarchy
SystemObject
  pdftron.PDFElementReader

Namespace:  pdftron.PDF
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class ElementReader : IClosable

The ElementReader type exposes the following members.

Constructors
  NameDescription
Public methodElementReader
Instantiates a new element reader.
Top
Methods
  NameDescription
Public methodBegin(Obj)
Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream.
Public methodBegin(Page)
Begin processing a page.
Public methodBegin(Obj, Obj)
Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream.
Public methodBegin(Page, Context)
Public methodBegin(Obj, Obj, Context)
Public methodClearChangeList
Clear the list containing identifiers of modified graphics state attributes. The list of modified attributes is then accumulated during a subsequent call(s) to ElementReader.Next().
Public methodClose
Public methodCurrent
Current.
Public methodEnd
Close the current display list. If the current display list is a sub-list created using FormBegin(), PatternBegin(), or Type3FontBegin() methods, the function will end the sub-list and will return processing to the parent display list at the point where it left off before entering the sub-list.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFormBegin
When the current element is a form XObject you have the option to skip form processing (by not calling FormBegin()) or to open the form stream and continue Element traversal into the form. To open a form XObject display list use FormBegin() method. The Next() returned Element will be the first Element in the form XObject display list. Subsequent calls to Next() will traverse form's display list until NULL is returned. At any point you can close the form sub-list using ElementReader::End() method. After the form display list is closed (using End()) the processing will return to the parent display list at the point where it left off before entering the form XObject.
Public methodGetChangesIterator
Gets the changes iterator.
Public methodGetColorSpace
Gets the color space.
Public methodGetExtGState
Gets the ext g state.
Public methodGetFont
Gets the font.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetPattern
Gets the pattern.
Public methodGetShading
Gets the shading.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetXObject
Gets the x object.
Public methodIsChanged
Checks if is changed.
Public methodNext
Next.
Public methodPatternBegin(Boolean)
Pattern begin.
Public methodPatternBegin(Boolean, Boolean)
A method used to spawn the sub-display list representing the tiling pattern of the current element in the ElementReader. You can call this method at any point as long as the current element is valid.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodType3FontBegin
A method used to spawn a sub-display list representing a Type3 Font glyph. You can call this method at any point as long as the current element in the ElementReader is a text element whose font type is type 3.
Top
Examples
For a full sample, please refer to ElementReader and ElementReaderAdv sample projects. A sample use case for ElementReader is given below:
...
ElementReader reader=new ElementReader();
reader.Begin(page);
for (Element element=reader.next(); element!=null;element=reader.next()) {
Rect bbox;
if((bbox=element.getBBox())!=null) System.out.println("Bounding Box: " + bbox.getRectangle());
switch (element.getType())    {
case Element.e_path: { // Process path data...
double[] data = element.getPathPoints();
}
break;
case Element.e_text:
// ...
break;
}
}
reader.End();
See Also