def asciiHexEncode(stream):
    """
        Method to encode streams using hexadecimal encoding

        @param stream: A PDF stream
        @return: A tuple (status,statusContent), where statusContent is the encoded PDF stream in case status = 0 or an error in case status = -1
    """
    try:
        encodedStream = stream.encode('hex')
    except:
        return -1, 'Error in hexadecimal conversion'
    return 0, encodedStream
