Method: PDF::Reader::Page#initialize

Defined in:
lib/pdf/reader/page.rb

#initialize(objects, pagenum, options = {}) ⇒ Page

creates a new page wrapper.

  • objects - an ObjectHash instance that wraps a PDF file

  • pagenum - an int specifying the page number to expose. 1 indexed.



33
34
35
36
37
38
39
40
41
# File 'lib/pdf/reader/page.rb', line 33

def initialize(objects, pagenum, options = {})
  @objects, @pagenum = objects, pagenum
  @page_object = objects.deref(objects.page_references[pagenum - 1])
  @cache       = options[:cache] || {}

  unless @page_object.is_a?(::Hash)
    raise ArgumentError, "invalid page: #{pagenum}"
  end
end