Multiple output formats

Author: ELToulemondeCreated Nov 6, 2018Updated May 1, 2025
LabelsFeature Request

Hi,

Tesseract feature Tesseract allows to make a single call and have multiple output format for example:

tesseract yourimage.tif out pdf tsv

This will generate an out.pdf and an out.tsv; hence at the same time retrieve OCR results in a readable format by python and a searchable pdf.

Doing both formats at the same time is interesting because according to my experiences it is twice faster. I believe that it is due to avoiding redoing the OCR computation.

Not possible with pytesseract But using this feature is not possible with pytesseract since you expose only specific functions (one for each task)

Potential solutions

  1. Edit function image_to_pdf_or_hocr to make it accept extension such as pdf tsv Meaning modifying
 if extension not in ['pdf', 'hocr']:
     extension = 'txt'
  1. Expose function run_tesseract and (with some precaution on extension) run_and_get_output
  2. Create a new specific function which handle list of formats