Class: Rodolfo::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/rodolfo/reader.rb

Overview

Reads a PDF info and metadata

Instance Method Summary collapse

Constructor Details

#initialize(pdf) ⇒ Reader

Returns a new instance of Reader.



8
9
10
# File 'lib/rodolfo/reader.rb', line 8

def initialize(pdf)
  @reader = PDF::Reader.new pdf
end

Instance Method Details

#to_hObject



12
13
14
15
16
17
18
19
# File 'lib/rodolfo/reader.rb', line 12

def to_h
  {
    PdfVersion: @reader.pdf_version,
    Info: @reader.info,
    Meta: @reader.,
    Pages: @reader.page_count
  }
end

#to_jsonObject



21
22
23
# File 'lib/rodolfo/reader.rb', line 21

def to_json
  JSON.pretty_generate to_h
end