heavysixer / node-pptx

Generate PPTX files on the server-side with JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to integrate with this from my electron app with vue

dongkyu9315 opened this issue · comments

Hi all, thanks all for creating and maintaining this package.

I am trying to create an electron app that creates a pptx file via nodejs. I have added a dependency to this package and trying to run it, but whenever I try to import an existing pptx file, it throws below error [1], which seems like coming from this line [2]. I have listed below how to reproduce this error. Please let me know if there's anything I am missing or you need anything else to debug. Thank you so much!

[1]

(node:34950) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/../fragments/[Content_Types].xml'
    at Object.openSync (node:fs:601:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:2:1869)
    at Object.readFileSync (node:fs:469:35)
    at Object.readFileSync (node:electron/js2c/asar_bundle:2:9212)
    at ContentTypeFactory.build (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:197426:31)
    at PowerPointFactory.build (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:204005:29)
    at new PowerPointFactory (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:203972:10)
    at new Presentation (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:204163:30)
    at new Composer (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:204292:25)
    at generatePPTX (/Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:205722:15)
    at /Users/dongkyukim/workplace/hymn-lyrics-ppt-app/packages/electron-app/dist-electron/main.js:205781:3
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:89468)
    at WebContents.emit (node:events:513:28)

[2]

xml2js.parseString(fs.readFileSync(`${__dirname}/../fragments/[Content_Types].xml`), (err, js) => {

How to reproduce

  1. git clone https://github.com/dongkyu9315/hymn-lyrics-ppt-app.git
  2. cd hymn-lyrics-ppt-app
  3. yarn run dev:all (this will start an electron app)
  4. Click the Trigger convert button and you will see an error

Nvm... ended up using python for pptx generation