Giter VIP home page Giter VIP logo

airppt-parser's Introduction

Project Overview

Wouldn't it be great if we could use a slideshow canvas as WSIWYG editor to rapidly design and ship UIs or start coding?

Airppt was built from the ground up to utilize the design elements of PPT presentations and reuse them anywhere. It is built with modularity, extensibility and flexibility in mind whilst abstracting a lot of the complexity. It's not a direct PPTX -> HTML converter; more like PPTX -> JSON -> HTML instead.

I'd also love for you to contribute. New to open source? I'm happy to walkthrough how to close your first issue. Pick a time that works best for you.

airppt-parser

Powerpoint stores information in a series of complex XML mappings. Checkout the OpenXML Spec to get an idea of how complex it really is.

The parser reads a Powerpoint file, takes in a slide number, and parses it to a standardized JSON object. The JSON object returned is defined as a PowerPointElement.

After utilizing the parser, we can pass it on to the renderer module to generate clean HTML/CSS, or you could use the object as you wish in your own application.

Usage

I highly recommend looking at the tests folder. I continually keep that up-to-date. Be sure to get the latest package from NPM.

let { AirParser } = require("airppt-parser");

let pptParser = new AirParser("./sample.pptx");
waitForParsing();

async function waitForParsing() {
	//pass in the slide number and wait
	let result = await pptParser.ParsePowerPoint(1);

	//returns an array of Powerpoint Elements and some extra MetaData
	console.log(result);
}

Powerpoint Element

Here is the interface definition of a PowerpointElement:

export interface PowerpointElement {
	name: string;
	shapeType: ElementType;
	specialityType: SpecialityType;
	elementPosition: {
		x: number,
		y: number
	};
	elementOffsetPosition: {
		cx: number,
		cy: number
	};
	paragraph?: {
		text: string,
		textCharacterProperties: {
			fontAttributes: FontAttributes[],
			font: string,
			size: number,
			fillColor: string
		},
		paragraphProperties: {
			alignment: TextAlignment
		}
	};
	shape?: {
		border?: {
			thickness: number,
			color: string,
			type: BorderType,
			radius?: number
		},
		fill: {
			fillType: FillType,
			fillColor: string
		},
		opacity: number
	};
	fontStyle?: {
		font: string,
		fontSize: number,
		fontColor: string
	};
	links?: {
		Type: LinkType,
		Uri: string
	};
	raw: any;
}

There's are also a number of enums as well. See the entire interface here.

airppt-parser's People

Contributors

rlingineni avatar

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.