### Question:
PdfUtilities { public static File[] convertPdf2Png(File inputPdfFile) { File imageDir = inputPdfFile.getParentFile(); if (imageDir == null) { String userDir = System.getProperty("user.dir"); imageDir = new File(userDir); } Ghostscript gs = Ghostscript.getInstance(); 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%03d.png"); gsArgs.add(inputPdfFile.getPath()); try { synchronized (gs) { gs.initialize(gsArgs.toArray(new String[0])); gs.exit(); } } catch (GhostscriptException e) { logger.error(e.getCause() != null ? e.getCause().toString() : e.getMessage(), e); } finally { try { Ghostscript.deleteInstance(); } catch (GhostscriptException e) { } } File[] workingFiles = imageDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().matches("workingimage\\d{3}\\.png$"); } }); Arrays.sort(workingFiles, new Comparator<File>() { @Override public int compare(File f1, File f2) { return f1.getName().compareTo(f2.getName()); } }); return workingFiles; }  static File convertPdf2Tiff(File inputPdfFile); static File[] convertPdf2Png(File inputPdfFile); static void splitPdf(String inputPdfFile, String outputPdfFile, String firstPage, String lastPage); static void splitPdf(File inputPdfFile, File outputPdfFile, int firstPage, int lastPage); static int getPdfPageCount(String inputPdfFile); static int getPdfPageCount(File inputPdfFile); static void mergePdf(File[] inputPdfFiles, File outputPdfFile); static final String GS_INSTALL; }### Answer:
@Test public void testConvertPdf2Png() { logger.info("convertPdf2Png"); File inputPdfFile = new File(this.TEST_RESOURCES_DATA_PATH, "1.pdf"); File[] results = PdfUtilities.convertPdf2Png(inputPdfFile); assertTrue(results.length > 0); }