Class: Pdfrb::Document::Info
- Inherits:
-
Object
- Object
- Pdfrb::Document::Info
- Defined in:
- lib/pdfrb/document/info.rb
Overview
Document Info dictionary facade (PDF 1.x metadata on /Info). Also bridges to XMP packet so both metadata representations stay in sync. PDF 2.0 deprecates /Info in favor of XMP-only, but /Info is still required for backward compatibility.
Constant Summary collapse
- FIELD_MAP =
{ title: :Title, author: :Author, subject: :Subject, keywords: :Keywords, creator: :Creator, producer: :Producer, }.freeze
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #creation_date ⇒ Object
- #creation_date=(value) ⇒ Object
-
#info_dict ⇒ Object
Returns the /Info dictionary object (creating one if needed).
-
#initialize(document) ⇒ Info
constructor
A new instance of Info.
- #mod_date ⇒ Object
- #mod_date=(value) ⇒ Object
- #trapped ⇒ Object
- #trapped=(value) ⇒ Object
Constructor Details
#initialize(document) ⇒ Info
Returns a new instance of Info.
12 13 14 |
# File 'lib/pdfrb/document/info.rb', line 12 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
10 11 12 |
# File 'lib/pdfrb/document/info.rb', line 10 def document @document end |
Instance Method Details
#creation_date ⇒ Object
35 36 37 |
# File 'lib/pdfrb/document/info.rb', line 35 def creation_date info_dict[:CreationDate] end |
#creation_date=(value) ⇒ Object
39 40 41 |
# File 'lib/pdfrb/document/info.rb', line 39 def creation_date=(value) set_info_field(:CreationDate, pdf_date(value)) end |
#info_dict ⇒ Object
Returns the /Info dictionary object (creating one if needed).
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/pdfrb/document/info.rb', line 60 def info_dict info_ref = document.trailer && document.trailer[:Info] return document.object(info_ref) if info_ref info = document.add({}, type: Pdfrb::Model::Cos::Dictionary) if document.trailer document.trailer[:Info] = Pdfrb::Model::Reference.new(info.oid, info.gen) end info end |
#mod_date ⇒ Object
43 44 45 |
# File 'lib/pdfrb/document/info.rb', line 43 def mod_date info_dict[:ModDate] end |
#mod_date=(value) ⇒ Object
47 48 49 |
# File 'lib/pdfrb/document/info.rb', line 47 def mod_date=(value) set_info_field(:ModDate, pdf_date(value)) end |
#trapped ⇒ Object
51 52 53 |
# File 'lib/pdfrb/document/info.rb', line 51 def trapped info_dict[:Trapped] end |
#trapped=(value) ⇒ Object
55 56 57 |
# File 'lib/pdfrb/document/info.rb', line 55 def trapped=(value) set_info_field(:Trapped, value) end |