Code Monkey home page Code Monkey logo

pptx2json's Introduction

pptx2json

Node.js CI npm MIT License

Operating Powerpoint file (Microsoft Office 2007 and later) as Office Open XML without external tools, just pure Javascript.
Providing two main functions:

  • Parse from a PowerPoint file to Json
  • Parse from a Json to PowerPoint

The images, movies, audio files and so on in a PowerPoint are treated as binary.
This is strongly inspired from pptx-compose.

Installation

$ npm install pptx2json

Usage

Parse a PowerPoint file to Json

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');

Rebuild a PowerPoint from Json

If you want to get a buffer below:

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');
:
// return buffer to pptx 
const pptx = await pptx2json.toPPTX(json);

Otherwise want to write a file below:

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson('path/to/pptx');
:
// write pptx to the path 
await pptx2json.toPPTX(json, {'file': 'path/to/output.pptx'});

Get max id, rid in slides.

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson(testPPTX);
const ids = pptx2json.getMaxSlideIds(json);
// {'id': 5, 'rid': 3}

Get slideLayoutType Hash.

const PPTX2Json = require('pptx2json');
const pptx2json = new PPTX2Json();

const json = await pptx2json.toJson(testPPTX);
const table = pptx2json.getSlideLayoutTypeHash(json);
// {
//    'title': 'ppt/slideLayouts/slideLayout1.xml',
//    'blank': 'ppt/slideLayouts/slideLayout7.xml'
// }

Dependencies

Reference

pptx2json's People

Contributors

dependabot[bot] avatar jotty-mcclure avatar x1- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pptx2json's Issues

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.