Class: Tabula::Extraction::PagesInfoExtractor
- Inherits:
-
Object
- Object
- Tabula::Extraction::PagesInfoExtractor
- Defined in:
- lib/tabula/extraction.rb
Instance Method Summary collapse
-
#initialize(pdf_filename, password = '') ⇒ PagesInfoExtractor
constructor
A new instance of PagesInfoExtractor.
- #pages ⇒ Object
Constructor Details
#initialize(pdf_filename, password = '') ⇒ PagesInfoExtractor
Returns a new instance of PagesInfoExtractor.
308 309 310 311 312 |
# File 'lib/tabula/extraction.rb', line 308 def initialize(pdf_filename, password='') @pdf_filename = pdf_filename @pdf_file = Extraction.openPDF(pdf_filename, password) @all_pages = @pdf_file.getDocumentCatalog.getAllPages end |
Instance Method Details
#pages ⇒ Object
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/tabula/extraction.rb', line 314 def pages Enumerator.new do |y| begin @all_pages.each_with_index do |page, i| contents = page.getContents y.yield Tabula::Page.new(@pdf_filename, page.findCropBox.width, page.findCropBox.height, page.getRotation.to_i, i+1) #remember, these are one-indexed end ensure @pdf_file.close end end end |