def asciiHexDecode(stream):
    """
        Method to decode streams using hexadecimal encoding

        @param stream: A PDF stream
        @return: A tuple (status,statusContent), where statusContent is the decoded PDF stream in case status = 0 or an error in case status = -1
    """
    eod = '>'
    decodedStream = ''
    char = ''
    index = 0
    while index < len(stream):
        c = stream[index]
        if c == eod:
            if len(decodedStream) % 2 != 0:
                char += '0'
                try:
                    decodedStream += chr(int(char, base=16))
                except:
                    return -1, 'Error in hexadecimal conversion'
            break
        elif c.isspace():
            index += 1
            continue
        char += c
        if len(char) == 2:
            try:
                decodedStream += chr(int(char, base=16))
            except:
                return -1, 'Error in hexadecimal conversion'
            char = ''
        index += 1
    return 0, decodedStream
