js-pptx

Pure Javascript reader-writer for Node.js

Overview

  • Read, write, edit PowerPoint presentations in Javascript
  • Pure-Javascript implementation of OpenXML
  • Tested on Node.js 4.0+
  • Tested in Chrome, Firefox, Safari, and IE 9+
  • Shapes, tables, images, charts, text, comments, ...
  • Built around JSZip and xml2js
  • High-level classes for semantic convenience
  • Direct access to the OpenXML structure
  • Classes for handling relations and embeddings
  • Constructor takes a PPTX file as template
  • Extensive unit tests for quality and examples
  • API documentation and examples
  • "Clean room" development under Microsoft CNS
  • Same library used in production by Protobi
  • Contributing Sponsorship

  • Private open-source access (under NDA)
  • Deploy via private NPM
  • Professional support, direct from development team
  • Fork repo and make private extensions .
  • Ability to contribute pull requests to main branch.
  • Contribute to development agenda
  • Cost

  • $14,800 for perpetual OEM license for commercial use.
  • $4,800 per year access for maintenance releases
  • High and low-level access

    Use high-level Javascript classes for simple semantic access:
    shape.getGeometry().shape('trapezoid')
    
    Or access the XML directly to do anything that the OpenXML allows, even if it's not yet in the high-level API:
    shape.child('a:prstGeom').attr('prst', 'trapezoid')
    
    This way, you're never at the mercy of another development team to add an obscure feature that you simply require.

    Basic example

    // read existing template
    fs.readFile(INFILE, function (err, data) {
        if (err) throw err;
        var pptx = PPTX();
        pptx.load(data, function (err) {
    
        // create new slide from layout
        var slide = pptx.addSlide("slideLayout3");
    
        // edit shape text in place
        slide.getShapes(0).text("Revised text");
    
        // create new shape
        var shape = slide.addShape();
        shape.text("72pt Red Arial");
    
        shape.getShapeProperties()
            .x(PPTX.emu.inch(1))
            .y(PPTX.emu.inch(2))
            .cx(PPTX.emu.inch(7))
            .cy(PPTX.emu.inch(1))
            .prstGeom('rect')
            .setNoFill(true)
            .setNoEffects(true)
    
        shape.getStyle()
            .fillSchemeColor('lt2')
            .fontSchemeColor('accent2');
    
        // detailed control of text
        shape.getTextBody()
          .getParagraphs()[0]
          .getRuns()[0].getProperties()
            .size(7200)
            .setTypeface('Arial')
            .italic('1')
            .bold('1')
            .underline('sng')
            .strike('sngStrike')
    
        shape.getTextBody().getBodyProperties()
            .wrap('none')
            .attr('rtlCol', '0') // direct XML
            .anchor('right')
    
        // Use JSZip API to stream/zip/save...
        fs.writeFile(OUTFILE, pptx.toBuffer());
    
    
    

    Contact us

    Protobi is about practical solutions. We'll help you get your web site generating native PowerPoint in your template.

    Generate native PPTX in your template

    Contact us