问题描述:
Aspose.Slide PPT幻灯片的背景读取错误
开发环境:Java8 Win10系统
工具包版本Aspose.Slide 19.11
使用幻灯片文件见附件:
圆.zip (227.8 KB)
原始幻灯片的背景效果如幻灯片所示,为如下效果幻灯片背景主题效果.png (64.0 KB)
读取出来的幻灯片背景效果如下图所示:
background280569240506400.jpg (32.6 KB)
可以看出两者效果对比有很大误差,使用的Java代码如下:
package com.xh.slides.examples.Slides.Background;
import com.aspose.slides.IBackground;
import com.aspose.slides.IFillFormatEffectiveData;
import com.aspose.slides.ISlide;
import com.aspose.slides.Presentation;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* @author xwj
* @date 2019/12/11 0011 9:38
* @description 获取幻灯片的主题信息
*/
public class GetThemeOfSlide {
public static void main(String[] args) {
Presentation pres = new Presentation("E:\\document\\圆.pptx");
//读取第一张幻灯片
ISlide slide = pres.getSlides().get_Item(0);
//
IBackground background = slide.getBackground();
IFillFormatEffectiveData fillFormatEffectiveData = background.getFillFormat().getEffective();
String picturePath = write(fillFormatEffectiveData.getPictureFillFormat().getPicture().getImage().getSystemImage());
System.out.println(picturePath);
}
public static String write(BufferedImage bi) {
String sourceName = "E:\\document\\background" + System.nanoTime() + ".jpg";
try {
ImageIO.write(bi, "jpeg", new File(sourceName));
} catch (IOException e) {
e.printStackTrace();
}
return sourceName;
}
}
请问如何才能正确读取到PPT的背景效果呢?