Module: AnyStyle::PdfUtils

Included in:
Document
Defined in:
lib/anystyle/utils.rb

Class Method Summary collapse

Class Method Details

.pdf_info(path) ⇒ Object



58
59
60
61
62
# File 'lib/anystyle/utils.rb', line 58

def pdf_info(path)
  Hash[%x{pdfinfo -isodates "#{path}"}.split("\n").map { |ln|
    ln.split(/:\s+/, 2)
  }]
end

.pdf_meta(path) ⇒ Object



64
65
66
# File 'lib/anystyle/utils.rb', line 64

def pdf_meta(path)
  %x{pdfinfo -meta -isodates "#{path}"}
end

.pdf_to_text(path, layout: true) ⇒ Object



54
55
56
# File 'lib/anystyle/utils.rb', line 54

def pdf_to_text(path, layout: true)
  %x{pdftotext #{layout ? ' -layout' : ''} -eol unix -q "#{path}" -}
end