Git Product home page Git Product logo

pptx-compose's Introduction

pptx-compose npm version

Parses Open Office XML generated PPTX to JSON

Install

$ npm install pptx-compose

See changelog here for API updates and compatibility issues.

Usage

import PPTXCompose from "pptx-compose";

// Initialize repo
const composer = new PPTXCompose(options);

// Parses a PPTX file to JSON
const pptx = await composer.toJSON("/path/to/my.pptx");

// Parses JSON output to PPTX
const json = await composer.toPPTX("/path/to/my.json");

CLI

Composer is able to generate JSON from PPTX source directly from CLI, run:

# Usage: convert [options] <input> <output>
# Options:
#   -V, --version  output the version number
#   -i, --input    PPTX File
#   -o, --output   Output JSON file (optional)
#   -h, --help     display help for command

$ node bin/convert ./path/to/my.pptx path/to/your/directory/generated.json

Options

attribute type default
jszipBinary "nodebuffer" / "base64" / "text" / "binarystring" / \ "array" / "uint8array" / "arraybuffer" / "blob" nodebuffer
jszipGenerateType "nodebuffer" / "base64" / "text" / "binarystring" / \ "array" / "uint8array" / "arraybuffer" / "blob" nodebuffer

Methods

PPTX Composer has following built-in methods:

.toJSON(<pptx_file_path>, <options{Options & { output: string }}>)

Parse PowerPoint file to JSON.

const composer = new PPTXCompose();

// Parses a PPTX file to JSON
const pptx = await composer.toJSON("/path/to/my.pptx");

// Convert a PPTX file to JSON file
composer.toJSON("/path/to/my.pptx", {
  output: "/path/to/output/file.pptx",
});

.toPPTX(<json>, <options{Options & { output: string }}>)

Convert JSON file to PPTX.

const composer = new PPTXCompose('{ "my": "json" ... }');

// Parses JSON output to PPTX
const json = await composer.toPPTX("/path/to/my.json");

// Convert JSON to PPTX file
composer.toJSON("/path/to/my.json", {
  output: "/path/to/output/file.pptx",
});

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.