class HexaPDF::CLI::Inspect

def pdf_object_from_string_reference(str)

Resolves the PDF object from the given string reference and returns it.
def pdf_object_from_string_reference(str)
  if str.nil?
    raise Error, "Error: Missing argument object identifier OID[,GEN]"
  elsif !str.match?(/^\d+(,\d+)?$/)
    raise Error, "Error: Invalid argument: Must be of form OID[,GEN], not '#{str}'"
  elsif !(obj = @doc.object(pdf_reference_from_string(str)))
    raise Error, "Error: No object with the given object identifier '#{str}' found"
  else
    obj
  end
end