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
: (Integer) -> PDF::Reader::Page
227 228 229 230 231 232 233 |
# File 'lib/pdf/reader.rb', line 227 def page(num) num = num.to_i if num < 1 || num > self.page_count raise InvalidPageError, "Valid pages are 1 .. #{self.page_count}" end PDF::Reader::Page.new(@objects, num, :cache => @cache) end |