Class Origami::Trailer
In: sources/parser/trailer.rb
sources/parser/obfuscation.rb
Parent: Object

Class representing a PDF file Trailer.

Methods

Included Modules

Configurable

Attributes

dictionary  [R] 
pdf  [RW] 
startxref  [RW] 

Public Class methods

Creates a new Trailer.

startxref:The file offset to the XRef::Section.
dictionary:A hash of attributes to set in the Trailer Dictionary.

[Source]

     # File sources/parser/trailer.rb, line 112
112:     def initialize(startxref = 0, dictionary = {})
113:      
114:       @startxref, self.dictionary = startxref, dictionary.nil? ? nil : Dictionary.new(dictionary)
115:     end

Public Instance methods

[Source]

     # File sources/parser/trailer.rb, line 134
134:     def [](key)
135:       @dictionary[key] if has_dictionary?
136:     end

[Source]

     # File sources/parser/trailer.rb, line 138
138:     def []=(key,val)
139:       @dictionary[key] = val
140:     end

[Source]

     # File sources/parser/trailer.rb, line 142
142:     def dictionary=(dict)
143:       dict.parent = self if dict
144:       @dictionary = dict
145:     end

[Source]

     # File sources/parser/trailer.rb, line 147
147:     def has_dictionary?
148:       not @dictionary.nil?
149:     end

[Source]

     # File sources/parser/obfuscation.rb, line 224
224:     def to_obfuscated_str
225:       content = ""
226:       if self.has_dictionary?
227:         content << TOKENS.first << EOL << @dictionary.to_obfuscated_str << EOL
228:       end
229: 
230:       content << XREF_TOKEN << EOL << @startxref.to_s << EOL << TOKENS.last << EOL
231: 
232:       content
233:     end

Outputs self into PDF code.

[Source]

     # File sources/parser/trailer.rb, line 154
154:     def to_s
155:       
156:       content = ""
157:       if self.has_dictionary?
158:         content << TOKENS.first << EOL << @dictionary.to_s << EOL
159:       end
160:       
161:       content << XREF_TOKEN << EOL << @startxref.to_s << EOL << TOKENS.last << EOL
162:                     
163:       content
164:     end

[Validate]