使用apache.poi的包将ppt转成图片 生成图片之后,图片无法识别文字,请问下是什么情况
free spire.presentation.jar 包转出来的图片效果:
import com.spire.presentation.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
public class PPTtoPNG {
public static void main(String[] args) throws Exception{
//创建Presentation对象
Presentation ppt = new Presentation();
//加载示例文档
ppt.loadFromFile("sample.pptx");
//遍历幻灯片
for (int i = 0; i < ppt.getSlides().getCount(); i++) {
//将幻灯片保存为BufferedImage对象
BufferedImage image = ppt.getSlides().get(i).saveAsImage();
//将BufferedImage保存为PNG格式文件
String fileName = String.format("ToImage.png", i);
ImageIO.write(image, "PNG",new File(fileName));
}
ppt.dispose();
}
}