Method: PDF::Reader#page

Defined in:
lib/pdf/reader.rb

#page(num) ⇒ Object

returns a single PDF::Reader::Page for the specified page. Use this instead of pages method when you need to access just a single page

reader = PDF::Reader.new("somefile.pdf")
page   = reader.page(10)

puts page.text

See the docs for PDF::Reader::Page to read more about the methods available on each page



193
194
195
196
197
198
199
# File 'lib/pdf/reader.rb', line 193

def page(num)
  num = num.to_i
  if num < 1 || num > self.page_count
    raise ArgumentError, "valid pages are 1 .. #{self.page_count}"
  end
  PDF::Reader::Page.new(@objects, num, :cache => @cache)
end