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.
374 375 376 377 378 |
# File 'lib/tabula/extraction.rb', line 374 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
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/tabula/extraction.rb', line 380 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 |