updated to work with older versions of tesseract that don't support stdin and stdout (pre 3.03)