Class: RPDF::Trailer

Inherits:
Object
  • Object
show all
Defined in:
lib/rpdf/trailer.rb

Overview

File Trailer [PDFRef15 p72]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Trailer

Returns a new instance of Trailer.



13
14
15
# File 'lib/rpdf/trailer.rb', line 13

def initialize(document)
  @document = document
end

Instance Attribute Details

#startxrefObject

Returns the value of attribute startxref.



11
12
13
# File 'lib/rpdf/trailer.rb', line 11

def startxref
  @startxref
end

Instance Method Details

#to_pdfObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/rpdf/trailer.rb', line 17

def to_pdf
  dict = PDFDictionary.new({ :Size => @document.size + 1,
                             :Root => @document.root })

  bytes = "trailer\n"
  bytes << dict.to_pdf
  bytes << "\nstartxref\n"
  bytes << startxref.to_s << "\n"
  bytes << "%%EOF\n" 
end