### Install PptxGenJS with npm
Source: https://gitbrent.github.io/PptxGenJS/docs/installation
Installs the PptxGenJS library using the npm package manager. This is the recommended method for Node.js projects.
```bash
npm install pptxgenjs
```
--------------------------------
### Quick Start: Create a Presentation in Script/Web Browser
Source: https://gitbrent.github.io/PptxGenJS/docs/introduction
This code example demonstrates the fundamental steps for generating a PowerPoint presentation with PptxGenJS when used directly in a web browser via a script tag. It includes creating a presentation instance, adding a slide, inserting text, and initiating the file save process.
```javascript
// 1. Create a new Presentation
let pres = new PptxGenJS();
// 2. Add a Slide
let slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile();
```
--------------------------------
### Quick Start: Create a Presentation in Angular/React/ES6/TypeScript
Source: https://gitbrent.github.io/PptxGenJS/docs/introduction
This code example illustrates the basic steps to create a PowerPoint presentation using PptxGenJS in an Angular, React, ES6, or TypeScript environment. It covers initializing a presentation, adding a slide, adding text to the slide, and saving the presentation file.
```javascript
import pptxgen from "pptxgenjs";
// 1. Create a new Presentation
let pres = new pptxgen();
// 2. Add a Slide
let slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile();
```
--------------------------------
### Install PptxGenJS with yarn
Source: https://gitbrent.github.io/PptxGenJS/docs/installation
Installs the PptxGenJS library using the yarn package manager. This is an alternative to npm for Node.js projects.
```bash
yarn add pptxgenjs
```
--------------------------------
### Include PptxGenJS via Separate CDN Files (Browser)
Source: https://gitbrent.github.io/PptxGenJS/docs/installation
Includes PptxGenJS in a web page by linking to separate CDN files for JSZip and the minified PptxGenJS library. This allows for more granular control over dependencies.
```html
```
--------------------------------
### Include PptxGenJS via CDN (Browser)
Source: https://gitbrent.github.io/PptxGenJS/docs/installation
Includes the PptxGenJS library in a web page using a CDN link. This method bundles PptxGenJS with its sole dependency, JSZip, into a single file for easy browser integration.
```html
```
--------------------------------
### Install PptxGenJS using npm or yarn
Source: https://gitbrent.github.io/PptxGenJS/docs/introduction
These commands show how to install the PptxGenJS library using either npm or yarn package managers. This is the first step for using the library in a Node.js-based project.
```bash
npm install pptxgenjs
```
```bash
yarn add pptxgenjs
```
--------------------------------
### Create Hello World Presentation (Node.js)
Source: https://gitbrent.github.io/PptxGenJS/docs/quick-start
Demonstrates how to create a simple 'Hello World' PowerPoint presentation using PptxGenJS in a Node.js environment. This involves initializing a presentation, adding a slide, adding a text box to the slide, and saving the file.
```typescript
import pptxgen from "pptxgenjs";
// 1. Create a Presentation
let pres = new pptxgen();
// 2. Add a Slide to the presentation
let slide = pres.addSlide();
// 3. Add 1+ objects (Tables, Shapes, etc.) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile({ fileName: "Hello-World.pptx" });
```
--------------------------------
### Create Hello World Presentation (Browser)
Source: https://gitbrent.github.io/PptxGenJS/docs/quick-start
Illustrates the creation of a 'Hello World' PowerPoint presentation using PptxGenJS within a client-side web browser. The process mirrors the Node.js version: instantiate presentation, add slide, add text, and write file.
```javascript
// 1. Create a new Presentation
let pres = new PptxGenJS();
// 2. Add a Slide
let slide = pres.addSlide();
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);
// 4. Save the Presentation
pres.writeFile({ fileName: "Hello-World.pptx" });
```
--------------------------------
### Convert HTML Table to PowerPoint Slides using PptxGenJS
Source: https://gitbrent.github.io/PptxGenJS/docs/introduction
This snippet demonstrates how to initialize the PptxGenJS library and convert an existing HTML table element into PowerPoint slides. It requires a valid table ID and exports the final presentation as a .pptx file.
```javascript
let pptx = new pptxgen();
pptx.tableToSlides("tableElementId");
pptx.writeFile({ fileName: "html2pptx-demo.pptx" });
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.