Class: Pdfrb::Model::Type::Catalog

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

Overview

Root of the document object hierarchy (s7.7.2). Linked from the trailer's /Root. Fields: /Type, /Version, /Extensions, /Pages, /PageLabels, /Names, /Dests, /ViewerPreferences, /PageLayout, /PageMode, /Outlines, /Threads, /OpenAction, /AA, /URI, /AcroForm, /Metadata, /StructTreeRoot, /MarkInfo, /Lang, /SpiderInfo, /OutputIntents, /PieceInfo, /OCProperties, /Perms, /Legal, /Requirements, /Collection, /NeedsRendering, /DSS, /AF, /DPartRoot.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, apply_arlington_definition, arlington_default, arlington_key_to_symbol, arlington_one_type_to_ruby, arlington_required?, arlington_scalar, 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, merged_field, own_fields, #pdf_type, register_type, type_map, #validate

Methods included from Cos::ArlingtonBacked

#arlington_object

Methods inherited from Object

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

Constructor Details

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

Instance Method Details

#acro_formObject



30
# File 'lib/pdfrb/model/type/catalog.rb', line 30

def acro_form; self[:AcroForm]; end

#additional_actionsObject



28
# File 'lib/pdfrb/model/type/catalog.rb', line 28

def additional_actions; self[:AA]; end

#associated_filesObject



45
# File 'lib/pdfrb/model/type/catalog.rb', line 45

def associated_files; self[:AF]; end

#collectionObject



42
# File 'lib/pdfrb/model/type/catalog.rb', line 42

def collection; self[:Collection]; end

#contains_form?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/pdfrb/model/type/catalog.rb', line 75

def contains_form?
  !!acro_form
end

#contains_outlines?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/pdfrb/model/type/catalog.rb', line 79

def contains_outlines?
  !!outlines
end

#contains_struct_tree?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/pdfrb/model/type/catalog.rb', line 71

def contains_struct_tree?
  !!struct_tree_root
end

#destinationsObject



21
# File 'lib/pdfrb/model/type/catalog.rb', line 21

def destinations; self[:Dests]; end

#dpart_rootObject



46
# File 'lib/pdfrb/model/type/catalog.rb', line 46

def dpart_root; self[:DPartRoot]; end

#dssObject



44
# File 'lib/pdfrb/model/type/catalog.rb', line 44

def dss; self[:DSS]; end

#each_output_intentObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/pdfrb/model/type/catalog.rb', line 114

def each_output_intent
  return enum_for(:each_output_intent) unless block_given?
  return unless output_intents && document

  arr = if output_intents.is_a?(Pdfrb::Model::Reference)
          document.object(output_intents)
        else
          output_intents
        end
  return unless arr.is_a?(Array) || arr.is_a?(Pdfrb::Model::PdfArray)

  arr.each do |entry|
    obj = document.resolve(entry)
    yield obj if obj
  end
end

#extensionsObject



48
# File 'lib/pdfrb/model/type/catalog.rb', line 48

def extensions; self[:Extensions]; end

#full_screen_mode?Boolean

Returns:

  • (Boolean)


64
# File 'lib/pdfrb/model/type/catalog.rb', line 64

def full_screen_mode?; page_mode&.to_sym == :FullScreen; end

#langObject



34
# File 'lib/pdfrb/model/type/catalog.rb', line 34

def lang; self[:Lang]; end


40
# File 'lib/pdfrb/model/type/catalog.rb', line 40

def legal; self[:Legal]; end

#mark_infoObject



33
# File 'lib/pdfrb/model/type/catalog.rb', line 33

def mark_info; self[:MarkInfo]; end

#metadataObject



31
# File 'lib/pdfrb/model/type/catalog.rb', line 31

def ; self[:Metadata]; end

#namesObject



20
# File 'lib/pdfrb/model/type/catalog.rb', line 20

def names; self[:Names]; end

#needs_rendering?Boolean

Returns:

  • (Boolean)


43
# File 'lib/pdfrb/model/type/catalog.rb', line 43

def needs_rendering?; truthy?(self[:NeedsRendering]); end

#oc_propertiesObject



38
# File 'lib/pdfrb/model/type/catalog.rb', line 38

def oc_properties; self[:OCProperties]; end

#one_column_layout?Boolean

Returns:

  • (Boolean)


51
# File 'lib/pdfrb/model/type/catalog.rb', line 51

def one_column_layout?; page_layout&.to_sym == :OneColumn; end

#open_actionObject



27
# File 'lib/pdfrb/model/type/catalog.rb', line 27

def open_action; self[:OpenAction]; end

#outlinesObject



25
# File 'lib/pdfrb/model/type/catalog.rb', line 25

def outlines; self[:Outlines]; end

#output_intentsObject



36
# File 'lib/pdfrb/model/type/catalog.rb', line 36

def output_intents; self[:OutputIntents]; end

#page_countObject



83
84
85
86
87
88
# File 'lib/pdfrb/model/type/catalog.rb', line 83

def page_count
  return 0 unless pages

  obj = pages.is_a?(Pdfrb::Model::Reference) && document ? document.object(pages) : pages
  obj && obj[:Count]
end

#page_labelsObject



19
# File 'lib/pdfrb/model/type/catalog.rb', line 19

def page_labels; self[:PageLabels]; end

#page_layoutObject



23
# File 'lib/pdfrb/model/type/catalog.rb', line 23

def page_layout; self[:PageLayout]; end

#page_modeObject



24
# File 'lib/pdfrb/model/type/catalog.rb', line 24

def page_mode; self[:PageMode]; end

#pagesObject



18
# File 'lib/pdfrb/model/type/catalog.rb', line 18

def pages; self[:Pages]; end

#permsObject



39
# File 'lib/pdfrb/model/type/catalog.rb', line 39

def perms; self[:Perms]; end

#piece_infoObject



37
# File 'lib/pdfrb/model/type/catalog.rb', line 37

def piece_info; self[:PieceInfo]; end

#requirementsObject



41
# File 'lib/pdfrb/model/type/catalog.rb', line 41

def requirements; self[:Requirements]; end

#resolved_acro_formObject



96
97
98
99
100
# File 'lib/pdfrb/model/type/catalog.rb', line 96

def resolved_acro_form
  return nil unless acro_form && document

  document.object(acro_form)
end

#resolved_metadataObject



108
109
110
111
112
# File 'lib/pdfrb/model/type/catalog.rb', line 108

def 
  return nil unless  && document

  document.object()
end

#resolved_outlinesObject



102
103
104
105
106
# File 'lib/pdfrb/model/type/catalog.rb', line 102

def resolved_outlines
  return nil unless outlines && document

  document.object(outlines)
end

#resolved_pagesObject



90
91
92
93
94
# File 'lib/pdfrb/model/type/catalog.rb', line 90

def resolved_pages
  return nil unless pages && document

  document.object(pages)
end

#single_page_layout?Boolean

Returns:

  • (Boolean)


50
# File 'lib/pdfrb/model/type/catalog.rb', line 50

def single_page_layout?; page_layout&.to_sym == :SinglePage; end

#spider_infoObject



35
# File 'lib/pdfrb/model/type/catalog.rb', line 35

def spider_info; self[:SpiderInfo]; end

#struct_tree_rootObject



32
# File 'lib/pdfrb/model/type/catalog.rb', line 32

def struct_tree_root; self[:StructTreeRoot]; end

#tagged?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/pdfrb/model/type/catalog.rb', line 67

def tagged?
  mark_info && !!mark_info[:Marked]
end

#threadsObject



26
# File 'lib/pdfrb/model/type/catalog.rb', line 26

def threads; self[:Threads]; end

#two_column_layout?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/pdfrb/model/type/catalog.rb', line 53

def two_column_layout?
  [:TwoColumnLeft, :TwoColumnRight].include?(page_layout&.to_sym)
end

#two_page_layout?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/pdfrb/model/type/catalog.rb', line 57

def two_page_layout?
  [:TwoPageLeft, :TwoPageRight].include?(page_layout&.to_sym)
end

#uriObject



29
# File 'lib/pdfrb/model/type/catalog.rb', line 29

def uri; self[:URI]; end

#use_attachments_mode?Boolean

Returns:

  • (Boolean)


61
# File 'lib/pdfrb/model/type/catalog.rb', line 61

def use_attachments_mode?; page_mode&.to_sym == :UseAttachments; end

#use_oc_mode?Boolean

Returns:

  • (Boolean)


65
# File 'lib/pdfrb/model/type/catalog.rb', line 65

def use_oc_mode?; page_mode&.to_sym == :UseOC; end

#use_outlines_mode?Boolean

Returns:

  • (Boolean)


63
# File 'lib/pdfrb/model/type/catalog.rb', line 63

def use_outlines_mode?; page_mode&.to_sym == :UseOutlines; end

#use_thumbs_mode?Boolean

Returns:

  • (Boolean)


62
# File 'lib/pdfrb/model/type/catalog.rb', line 62

def use_thumbs_mode?; page_mode&.to_sym == :UseThumbs; end

#version_overrideObject



47
# File 'lib/pdfrb/model/type/catalog.rb', line 47

def version_override; self[:Version]; end

#viewer_preferencesObject



22
# File 'lib/pdfrb/model/type/catalog.rb', line 22

def viewer_preferences; self[:ViewerPreferences]; end