Class: HexaPDF::CLI::Info

Inherits:
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

Methods included from Command::Extensions

#help, #help_banner

Constructor Details

#initializeInfo

:nodoc:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/hexapdf/cli/info.rb', line 52

def initialize #:nodoc:
  super('info', takes_commands: false)
  short_desc("Show document information")
  long_desc("    This command extracts information from the Info dictionary of a PDF file as well\n    as some other useful information like the used PDF version and encryption information.\n\n    If the --check option is specified, the PDF file will also be checked for parse and\n    validation errors. And if the process doesn't abort, HexaPDF is still able to handle the\n    file by correcting the errors.\n  EOF\n  options.on(\"--check\", \"-c\", \"Check the PDF file for parse errors and validity\") do |check|\n    @check_file = check\n  end\n  options.on(\"--password PASSWORD\", \"-p\", String,\n             \"The password for decryption. Use - for reading from standard input.\") do |pwd|\n    @password = (pwd == '-' ? read_password : pwd)\n  end\n  @password = nil\n  @auto_decrypt = true\n  @check_file = false\nend\n")

Instance Method Details

#execute(file) ⇒ Object

:nodoc:



75
76
77
# File 'lib/hexapdf/cli/info.rb', line 75

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