SVG in PPT( generated by Pptxgenjs) shown incorrectly when the PPT is opened in libreOffice

808 Views Asked by At

Pptxgenjs is able to add SVG images and generate PPT correctly. When this PPT is opened using Microsoft office, SVG images are shown properly. However, when this PPT is opened using libreOffice, SVG images are shown as invalid cross symbols as mentioned below.

PPT in LibreOffice

PPT in MS Office

  • ENV: Windows 10
  • LibreOffice Version 7

Am I missing something here?

1

There are 1 best solutions below

0
Andrey Potapov On

You can try using Aspose.Slides Cloud SDK for Node.js to add SVG images and other content to your presentations. You can evaluate this REST-based API making 150 free API calls per month for API learning and presentation processing. The following code example shows you how to add an SVG image to a presentation using Aspose.Slides Cloud:

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))
})

I work as a Support Developer at Aspose.