docs: @Override
      public void createDocuments(String[] filenames, String[] outputbases, List<RenderedFormat> formats) throws TesseractException {
          if (filenames.length != outputbases.length) {
              throw new RuntimeException("The two arrays must match in length.");
          }
  
          init();
          setTessVariables();
  
          try {
              for (int i = 0; i < filenames.length; i++) {
                  File inputFile = new File(filenames[i]);
                  File imageFile = null;
  
                  try {
                      // if PDF, convert to multi-page TIFF
                      imageFile = ImageIOHelper.getImageFile(inputFile);
  
                      TessResultRenderer renderer = createRenderers(outputbases[i], formats);
                      createDocuments(imageFile.getPath(), renderer);
                      api.TessDeleteResultRenderer(renderer);
                  } catch (Exception e) {
                      // skip the problematic image file
                      logger.warn(e.getMessage(), e);
                  } 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();
                      }
                  }
              }
          } finally {
              dispose();
          }
      }