Module: Pdfrb::Annotation
- Defined in:
- lib/pdfrb/annotation.rb,
lib/pdfrb/annotation/base.rb,
lib/pdfrb/annotation/types.rb
Overview
Annotation types (ISO 32000-2 ยง12.5). Each subtype is a thin builder
that produces a correctly-shaped annotation dictionary and registers
itself in the Annotation::REGISTRY for open/closed extensibility.
Defined Under Namespace
Classes: Base, Caret, Circle, FileAttachment, FreeText, Highlight, Ink, Line, Link, Polygon, Polyline, Popup, PrinterMark, Redact, Screen, Sound, Square, Squiggly, Stamp, StrikeOut, Text, Underline, Watermark, Widget
Class Method Summary
collapse
Class Method Details
.[](subtype) ⇒ Object
53
54
55
56
|
# File 'lib/pdfrb/annotation.rb', line 53
def [](subtype)
ensure_loaded
registry[subtype]
end
|
.create(subtype, document:, page:, **opts) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/pdfrb/annotation.rb', line 37
def create(subtype, document:, page:, **opts)
ensure_loaded
klass = registry[subtype]
return build_fallback(subtype, document, page, opts) unless klass
klass.create(document: document, page: page, **opts)
end
|
.register(subtype, klass) ⇒ Object
49
50
51
|
# File 'lib/pdfrb/annotation.rb', line 49
def register(subtype, klass)
registry[subtype] = klass
end
|
.registry ⇒ Object
45
46
47
|
# File 'lib/pdfrb/annotation.rb', line 45
def registry
@registry ||= {}
end
|
.subtypes ⇒ Object
58
59
60
61
|
# File 'lib/pdfrb/annotation.rb', line 58
def subtypes
ensure_loaded
registry.keys
end
|