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

Class representing a PDF file Trailer.

Methods

[]   []=   has_dictionary?   new   to_obfuscated_str   to_s  

Included Modules

Configurable

Attributes

dictionary  [RW] 
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 111
111:     def initialize(startxref = 0, dictionary = {})
112:      
113:       @startxref, @dictionary = startxref, dictionary.nil? ? nil : Dictionary.new(dictionary)
114:       
115:       @dictionary.parent = self if has_dictionary? 
116:     end

Public Instance methods

[Source]

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

[Source]

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

[Source]

     # File sources/parser/trailer.rb, line 144
144:     def has_dictionary?
145:       not @dictionary.nil?
146:     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 151
151:     def to_s
152:       
153:       content = ""
154:       if self.has_dictionary?
155:         content << TOKENS.first << EOL << @dictionary.to_s << EOL
156:       end
157:       
158:       content << XREF_TOKEN << EOL << @startxref.to_s << EOL << TOKENS.last << EOL
159:                     
160:       content
161:     end

[Validate]