server code (pre-processing and tesseract ocr)