Skip to content

Commit

Permalink
Merge pull request #476 from support-project/fix/issue471_parse_pptx
Browse files Browse the repository at this point in the history
#471 Fix filename of slide image on pptx parser process
  • Loading branch information
koda-masaru authored Oct 4, 2016
2 parents 4f41e54 + f48bac9 commit 6372a09
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import javax.imageio.ImageIO;

import org.apache.pdfbox.tools.imageio.ImageIOUtil;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.sl.draw.Drawable;
import org.apache.poi.sl.usermodel.Slide;
Expand Down Expand Up @@ -59,10 +60,12 @@ public void parse(File inputFile, File outputDir) throws ParseException {

// save the result
if (!"null".equals(format)) {
String outname = inputFile.getName().replaceFirst(".pptx?", "");
outname = String.format(Locale.ROOT, "%1$s-%2$04d.%3$s", outname, slideNo, format);
File outfile = new File(outputDir, outname);
ImageIO.write(img, format, outfile);
// String outname = inputFile.getName().replaceFirst(".pptx?", "");
// outname = String.format(Locale.ROOT, "%1$s-%2$04d.%3$s", outname, slideNo, format);
// File outfile = new File(outputDir, outname);
// ImageIO.write(img, format, outfile);
ImageIOUtil.writeImage(img, outputDir.getAbsolutePath() + "/" + (slideNo) + ".png", 300);

}
slideNo++;
}
Expand Down

0 comments on commit 6372a09

Please sign in to comment.