Problem with using APACHE-POI to convert PPT to Image
Posted
by SpawnCxy
on Stack Overflow
See other posts from Stack Overflow
or by SpawnCxy
Published on 2010-04-22T00:44:58Z
Indexed on
2010/04/22
0:53 UTC
Read the original article
Hit count: 575
Hi all,
I got a problem when I try to use Apache POI project to convert my PPT to Images.My code as follows:
FileInputStream is = new FileInputStream("test.ppt");
SlideShow ppt = new SlideShow(is);
is.close();
Dimension pgsize = ppt.getPageSize();
Slide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
BufferedImage img = new BufferedImage(pgsize.width, pgsize.height,
BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
//clear the drawing area
graphics.setPaint(Color.white);
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
//render
slide[i].draw(graphics);
//save the output
FileOutputStream out = new FileOutputStream("slide-" + (i+1) + ".png");
javax.imageio.ImageIO.write(img, "png", out);
out.close();
It works fine except that all Chinese words are converted to some squares.The png image I got is like following image: Then how can I fix this?Thanks in advance!
© Stack Overflow or respective owner