Module: Pdfrb::CLI::Info

Defined in:
lib/pdfrb/cli/info.rb

Class Method Summary collapse

Class Method Details

.call(path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/pdfrb/cli/info.rb', line 8

def call(path)
  doc = Pdfrb::Document.open(path)
  puts "File: #{path}"
  puts "Version: #{doc.version}"
  puts "Pages: #{doc.pages.count}"
  puts "Encrypted: #{!doc.trailer&.[](:Encrypt).nil?}"
  puts "Title: #{doc.[:Title]}" if doc.[:Title]
  puts "Author: #{doc.[:Author]}" if doc.[:Author]
  true
end