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

Extract presenter notes? #100

Open
SeyyedKhandon opened this issue Sep 21, 2022 · 0 comments
Open

Extract presenter notes? #100

SeyyedKhandon opened this issue Sep 21, 2022 · 0 comments

Comments

@SeyyedKhandon
Copy link

SeyyedKhandon commented Sep 21, 2022

How can one extract just the presenter notes?
The solution which I'm using is this:

// const fs = require("fs");
const PPTX2Json = require("pptx2json");
const pptx2json = new PPTX2Json();

pptx2json.toJson("./test.pptx").then((json) => {
  json = Object.keys(json)
    .filter((key) => key.includes("ppt/notesSlides/notesSlide"))
    .sort((a, b) => a - b)
    .map((key) =>
      json[key]["p:notes"]["p:cSld"][0]["p:spTree"][0]["p:sp"]
        .filter((item) => item["p:txBody"])
        .map((item) => item["p:txBody"][0]["a:p"])
        .map((item) => item.map((item) => item["a:r"]))[0]
        .filter((x) => x)
        .map((item) => [
          ...item.reduce((prev, curr) => [...prev, curr["a:t"]], []),
        ])
        .join(" ")
    );
  console.log(json);
  // fs.writeFileSync("./data.txt", JSON.stringify(json));
});

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