Class: HexaPDF::CLI::Info

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/hexapdf/cli/info.rb

Overview

Outputs various bits of information about PDF files:

  • The entries in the trailers /Info dictionary

  • Encryption information from the trailers /Encrypt dictionary

  • The number of pages

  • The used PDF version

See: HexaPDF::Type::Info, HexaPDF::Encryption::SecurityHandler

Instance Method Summary collapse

Constructor Details

#initializeInfo

:nodoc:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/hexapdf/cli/info.rb', line 49

def initialize #:nodoc:
  super('info', takes_commands: false)
  short_desc("Show document information")
  long_desc(<<-EOF.gsub!(/^ */, ''))
    This command extracts information from the Info dictionary of a PDF file as well
    as some other useful information like the used PDF version and encryption information.
  EOF
  options.on("--password PASSWORD", "-p", String,
             "The password for decryption. Use - for reading from standard input.") do |pwd|
    @password = (pwd == '-' ? command_parser.read_password : pwd)
  end
  @password = ''
  @auto_decrypt = true
end

Instance Method Details

#execute(file) ⇒ Object

:nodoc:



64
65
66
# File 'lib/hexapdf/cli/info.rb', line 64

def execute(file) #:nodoc:
  output_info(file)
end