PptxGenJS允许通过脚本创建Powerpoint文件。https://gitbrent.github.io/PptxGenJS/
我们可以添加镜像,如下所示:
slide.addImage({ path: "images/chart_world_peace_near.png", x:..., y:..., w:..., h:...});我需要调整图像大小到幻灯片的完整大小,与纵横比。因此,我需要知道图像的大小和幻灯片的大小,如下所示:
scaled_image_width = slide_width
scaled_image_height = image_height * scaled_image_width / image_width;
if (scaled_image_height > slide_height) {
scaled_image_height = slide_height
scaled_image_width = image_width * scaled_image_height / image_height;
}但是,我在PptxGenJS中看不到获取图像大小和幻灯片大小的方法。我如何才能做到这一点?
发布于 2021-03-24 23:59:29
您可以使用下面的内容为幻灯片添加背景
var pptx1 = new PptxGenJS();
var slide = pptx1.addSlide();添加幻灯片后,您可以为其添加背景
slide.background = {path:"Image URL"};https://stackoverflow.com/questions/64446410
复制相似问题