Class: Pdfrb::Model::Type::Thread

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/thread.rb

Overview

Thread (ISO 32000-2 §12.4.2, PDF 1.1+). Represents an article — a sequence of text blocks that flows across pages (e.g. a newspaper column that continues on a later page). Threads are listed in the Catalog's /Threads array.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, #empty?, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#first_bead(document = nil) ⇒ Object

/F — required indirect reference to the first Bead in the thread.



20
21
22
23
24
25
# File 'lib/pdfrb/model/type/thread.rb', line 20

def first_bead(document = nil)
  ref = value[:F]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#info(document = nil) ⇒ Object

/I — optional DocInfo dict with article metadata.



28
29
30
31
32
33
34
35
36
# File 'lib/pdfrb/model/type/thread.rb', line 28

def info(document = nil)
  ref = value[:I]
  return nil unless ref && document

  resolved = ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
  return nil unless resolved

  Pdfrb::Model::Type::Info.new(resolved.value) if resolved.value.is_a?(::Hash)
end

#metadata(document = nil) ⇒ Object

/Metadata — optional indirect stream (PDF 2.0).



39
40
41
42
43
44
# File 'lib/pdfrb/model/type/thread.rb', line 39

def (document = nil)
  ref = value[:Metadata]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#typeObject

/Type — optional, fixed "Thread".



14
15
16
# File 'lib/pdfrb/model/type/thread.rb', line 14

def type
  value[:Type]&.to_sym
end