A consumer of interpreted content: the one content interpreter runs a content stream through its graphics-state machine and calls these methods, so every consumer (renderer, text extractor, layout detector, editor) sees the same events computed once. Override what you need; every method does nothing by default.
public abstract class ContentProcessor
ISO 32000-2 §7.8.2 (content streams), §8.2 (graphics objects), §8.4 (graphics state), §8.5 (paths and clipping), §9.4 (text objects), §8.8 to §8.10 (XObjects and images), §8.7 (shadings), §14.6 (marked content). Geometry is device independent: paths in user space with State holding the CTM to the run's default user space.
Payloads are passed by reference and are views valid only during the call; the context and its state likewise. A processor copies what it keeps. Calls come from one thread; a processor may run nested content through the context during a call. Several processors share one run through CompositeContentProcessor.
Every event is reported: runs, operators, the state stack, paths and clips (issue #55); glyphs, text clips, images, forms, Type 3 glyph descriptions and marked content (issue #56); shadings (issue #79; a tiling pattern's cell runs on request through RunPatternCell(in PdfColor, ContentProcessor)). Payloads gain members over time; their existing members never change.
kind:method, kind:property, kind:ctor. Press Esc to clear.BeginForm(in FormEvent, ContentContext)Called when a form XObject's content is about to run (Forms).BeginMarkedContent(in MarkedContentEvent, ContentContext)Called at BMC and BDC (MarkedContent).BeginRun(ContentContext)Called when a run starts, before the first operator.BeginText(ContentContext)Called at BT (Text).BeginType3Glyph(in GlyphEvent, ContentContext)Called before a Type 3 glyph's procedure runs (Type3GlyphContent). Default: Skip.EndForm(in FormEvent, ContentContext)Called when a form XObject's content has run, for a form whose BeginForm(in FormEvent, ContentContext) returned Enter.EndMarkedContent(in MarkedContentEvent, ContentContext)Called at EMC, and implicitly for sequences still open at the end of a stream (MarkedContent).EndRun(ContentContext)Called when a run ends, after the implicit restores that close unbalanced q operators.EndText(ContentContext)Called at ET, before a text clip it sets (Text).EndType3Glyph(in GlyphEvent, ContentContext)Called after a Type 3 glyph's procedure ran, for a glyph whose BeginType3Glyph(in GlyphEvent, ContentContext) returned Enter.IntersectClip(in ClipEvent, ContentContext)Called when the clipping path narrows: after the paint that ends a path object with W or W*, at ET for text clips (Clips).MarkedContentPoint(in MarkedContentEvent, ContentContext)Called at MP and DP (MarkedContent).PaintImage(in ImageEvent, ContentContext)Called for an image XObject painted by Do and for an inline image (Images).PaintPath(in PathEvent, ContentContext)Called when a path object is painted, or ended with n (Paths).PaintShading(in ShadingEvent, ContentContext)Called for sh (Shadings).RestoreState(ContentContext)Called after the state is popped: by Q, and implicitly at the end of a stream with unbalanced q (StateStack).SaveState(ContentContext)Called after the state is pushed: by q, and implicitly when a nested stream starts (StateStack).ShowGlyph(in GlyphEvent, ContentContext)Called for every glyph shown (Glyphs).VisitOperator(in ContentOperator, ContentContext)Called for every operator, before it executes (Operators).