Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is addImage with svg supported for pptx file? #404

Open
petercoppensdatylon opened this issue Dec 1, 2022 · 0 comments
Open

Is addImage with svg supported for pptx file? #404

petercoppensdatylon opened this issue Dec 1, 2022 · 0 comments

Comments

@petercoppensdatylon
Copy link

Environment

  1. node -v: v16.15.1

  2. npm -v: 8.11.0

  3. npm ls officegen: [email protected]

  4. Operating system: MacOS Catalina

  5. Microsoft Office version: 16.65 (Powerpoint for Mac)

  6. Problem with Powerpoint, Excel or Word document: Powerpoint

Steps to Reproduce

Execute this

const officegen = require('officegen')
const fs = require('fs')
const { compose } = require('async')
const { sep } = require('path')
const os = require('os');
const tempDir = fs.mkdtempSync(`${os.tmpdir()}${sep}`);
const pptx = officegen({ type: 'pptx', tempDir: `a${tempDir}${sep}`});
slide = pptx.makeNewSlide()
slide.name = 'Pie Chart slide'
slide.back = 'ffff00'
// e.g. From  https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg
slide.addImage("tiger.svg");
return new Promise((resolve, reject) => {
  let out = fs.createWriteStream('example.pptx')
  pptx.on('error', function(err) {
    reject(err)
  })
  out.on('error', function(err) {
    reject(err)
  })
  out.on('close', function() {
    resolve()
  })
  pptx.generate(out)
}).then( r => console.log("done")).catch(e => console.error("Failed:" + JSON.stringify(e)));

Behavior: slide gives "The picture can't be displayed"

Expected: svg is in slide (as would be the case when using insert picture)


First question I guess...is using addImage to add an svg to a pptx file supported? If so, what is going wrong with the little test?

Tx!

Peter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant