Module: Tabula::Extraction

Defined in:
lib/tabula/extraction.rb,
lib/tabula/spreadsheet_extractor.rb

Defined Under Namespace

Classes: ObjectExtractor, PagesInfoExtractor, SpreadsheetExtractor

Class Method Summary collapse

Class Method Details

.openPDF(pdf_filename, password = '') ⇒ Object

Raises:

  • (Errno::ENOENT)


13
14
15
16
17
18
19
20
21
# File 'lib/tabula/extraction.rb', line 13

def Extraction.openPDF(pdf_filename, password='')
  raise Errno::ENOENT unless File.exists?(pdf_filename)
  document = PDDocument.load(pdf_filename)
  if document.isEncrypted
    sdm = StandardDecryptionMaterial.new(password)
    document.openProtection(sdm)
  end
  document
end