docs: @Override
      public String doOCR(File inputFile, Rectangle rect) throws TesseractException {
          try {
              File imageFile = ImageIOHelper.getImageFile(inputFile);
              String imageFileFormat = ImageIOHelper.getImageFileFormat(imageFile);
              Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFileFormat);
              if (!readers.hasNext()) {
                  throw new RuntimeException(ImageIOHelper.JAI_IMAGE_READER_MESSAGE);
              }
              ImageReader reader = readers.next();
              StringBuilder result = new StringBuilder();
              try (ImageInputStream iis = ImageIO.createImageInputStream(imageFile);) {
                  reader.setInput(iis);
                  int imageTotal = reader.getNumImages(true);
  
                  init();
                  setTessVariables();
  
                  for (int i = 0; i < imageTotal; i++) {
                      IIOImage oimage = reader.readAll(i, reader.getDefaultReadParam());
                      result.append(doOCR(oimage, inputFile.getPath(), rect, i + 1));
                  }
  
                  if (renderedFormat == RenderedFormat.HOCR) {
                      result.insert(0, htmlBeginTag).append(htmlEndTag);
                  }
              } finally {
                  // delete temporary TIFF image for PDF
                  if (imageFile != null && imageFile.exists() && imageFile != inputFile && imageFile.getName().startsWith("multipage") && imageFile.getName().endsWith(ImageIOHelper.TIFF_EXT)) {
                      imageFile.delete();
                  }
                  reader.dispose();
                  dispose();
              }
  
              return result.toString();
          } catch (Exception e) {
              logger.error(e.getMessage(), e);
              throw new TesseractException(e);
          }
      }