docs: public synchronized static File[] convertPdf2Png(File inputPdfFile) throws IOException {
          Path path = Files.createTempDirectory("tessimages");
          File imageDir = path.toFile();
  
          //get Ghostscript instance
          Ghostscript gs = Ghostscript.getInstance();
  
          //prepare Ghostscript interpreter parameters
          //refer to Ghostscript documentation for parameter usage
          List<String> gsArgs = new ArrayList<String>();
          gsArgs.add("-gs");
          gsArgs.add("-dNOPAUSE");
          gsArgs.add("-dQUIET");
          gsArgs.add("-dBATCH");
          gsArgs.add("-dSAFER");
          gsArgs.add("-sDEVICE=pnggray");
          gsArgs.add("-r300");
          gsArgs.add("-dGraphicsAlphaBits=4");
          gsArgs.add("-dTextAlphaBits=4");
          gsArgs.add("-sOutputFile=" + imageDir.getPath() + "/workingimage%04d.png");
          gsArgs.add(inputPdfFile.getPath());
  
          //execute and exit interpreter
          try {
              synchronized (gs) {
                  gs.initialize(gsArgs.toArray(new String[0]));
                  gs.exit();
              }
          } catch (UnsatisfiedLinkError e) {
              logger.error(e.getMessage());
              throw new RuntimeException(getMessage(e.getMessage()));
          } catch (NoClassDefFoundError e) {
              logger.error(e.getMessage());
              throw new RuntimeException(getMessage(e.getMessage()));
          } catch (GhostscriptException e) {
              logger.error(e.getMessage());
              throw new RuntimeException(e.getMessage());
          } finally {
              if (imageDir.list().length == 0) {
                  imageDir.delete();
              }
  
              //delete interpreter instance (safer)
              try {
                  Ghostscript.deleteInstance();
              } catch (GhostscriptException e) {
                  //nothing
              }
          }
  
          // find working files
          File[] workingFiles = imageDir.listFiles(new FilenameFilter() {
  
              @Override
              public boolean accept(File dir, String name) {
                  return name.toLowerCase().matches("workingimage\\d{4}\\.png$");
              }
          });
  
          Arrays.sort(workingFiles, new Comparator<File>() {
              @Override
              public int compare(File f1, File f2) {
                  return f1.getName().compareTo(f2.getName());
              }
          });
  
          return workingFiles;
      }