pptxgenjs 能够正确添加 SVG 图像并生成 PPT。使用 Microsoft Office 打开此 PPT 时,SVG 图像正确显示。但是,当使用 libreOffice 打开此 PPT 时,SVG 图像显示为无效的十字符号,如下所述。
- 环境:Windows 10
- LibreOffice 版本 7
我在这里错过了什么吗?
pptxgenjs 能够正确添加 SVG 图像并生成 PPT。使用 Microsoft Office 打开此 PPT 时,SVG 图像正确显示。但是,当使用 libreOffice 打开此 PPT 时,SVG 图像显示为无效的十字符号,如下所述。
我在这里错过了什么吗?
您可以尝试使用Aspose.Slides Cloud SDK for Node.js将 SVG 图像和其他内容添加到您的演示文稿中。您可以评估这个基于 REST 的 API,每月进行 150 次免费 API 调用,用于 API 学习和演示处理。以下代码示例向您展示了如何使用 Aspose.Slides Cloud 将 SVG 图像添加到演示文稿中:
const cloud = require("asposeslidescloud")
const model = require("asposeslidescloud/model")
const fs = require("fs")
const slidesApi = new cloud.SlidesApi("client_id", "client_key")
const fileName = "example.pptx"
const imagePath = "image.svg"
const slideIndex = 1
// Create a picture frame for the SVG image with a specified size and position.
var pictureFrame = new model.PictureFrame()
pictureFrame.pictureFillFormat = new model.PictureFill()
pictureFrame.pictureFillFormat.svgData = fs.readFileSync(imagePath, "utf8")
pictureFrame.X = 20
pictureFrame.Y = 20
pictureFrame.Width = 300
pictureFrame.Height = 200
// Add the picture frame on the slide.
slidesApi.createShape(fileName, slideIndex, pictureFrame).then((response) => {
console.log(JSON.stringify(response))
})
我在 Aspose 担任支持开发人员。