Class: Pdfrb::Document::Metadata
- Inherits:
-
Object
- Object
- Pdfrb::Document::Metadata
- Defined in:
- lib/pdfrb/document/metadata.rb
Constant Summary collapse
- STANDARD_FIELDS =
i[Title Author Subject Keywords Creator Producer CreationDate ModDate Trapped].freeze
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #[](field) ⇒ Object
- #[]=(field, value) ⇒ Object
-
#initialize(document) ⇒ Metadata
constructor
A new instance of Metadata.
- #to_xmp ⇒ Object
Constructor Details
#initialize(document) ⇒ Metadata
Returns a new instance of Metadata.
11 12 13 |
# File 'lib/pdfrb/document/metadata.rb', line 11 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
9 10 11 |
# File 'lib/pdfrb/document/metadata.rb', line 9 def document @document end |
Instance Method Details
#[](field) ⇒ Object
20 21 22 |
# File 'lib/pdfrb/document/metadata.rb', line 20 def [](field) read_field(field) end |
#[]=(field, value) ⇒ Object
24 25 26 |
# File 'lib/pdfrb/document/metadata.rb', line 24 def []=(field, value) write_field(field, value) end |
#to_xmp ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pdfrb/document/metadata.rb', line 28 def to_xmp begin packet = Pdfrb::XMP::Packet.new rescue StandardError return "" end title = read_field(:Title) packet.title = title if title packet.to_xmp end |