Skip to content

Commit b3acbfa

Browse files
committed
(docs) Show example with initial parameters
1 parent ccd8377 commit b3acbfa

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ This is a pptx generator for Node.js based on templates. It can read pptx files
55
This generator can only be used on the server-side and requires a [Node.js](https://nodejs.org/en/download/package-manager/) environment.
66

77
## Limitations
8-
Please note that this project is *work in progress*. At the moment, it is *not* possible to handle slides containing:
9-
* images
10-
* links
11-
* notes
12-
13-
Although, most other shape types are already supported, such as connection shapes or charts.
8+
Please note that this project is *work in progress*. At the moment, you might encounter difficulties for special shape types that require internal relations.
9+
Although, most shape types are already supported, such as connection shapes or charts.
1410

1511
## Install
16-
You can add this package to your own project using npm:
12+
You can add this package to your own project using npm or yarn:
1713
```
1814
yarn add pptx-automizer
1915
```
@@ -25,24 +21,27 @@ npm install pptx-automizer
2521
## Example
2622
```js
2723
import Automizer from "pptx-automizer"
28-
const automizer = new Automizer
2924

30-
// First, lets set some preferences
31-
const templateFolder = `my/pptx/templates`
32-
const outputFolder = `my/pptx/output`
25+
// First, let's set some preferences
26+
const automizer = new Automizer({
27+
templateDir: `my/pptx/templates`,
28+
outputDir: `my/pptx/output`
29+
})
3330

34-
// Let's start and import a root template. All slides will be appended to
35-
// any existing slides in RootTemplate.pptx
36-
let pres = automizer.importRootTemplate(`${templateFolder}/RootTemplate.pptx`)
31+
// Now start and import a root template. All slides will be appended to
32+
// any existing slide in RootTemplate.pptx
33+
let pres = automizer.importRootTemplate(`RootTemplate.pptx`)
3734
// We want to make two files available and give them a handy label.
38-
.importTemplate(`${templateFolder}/SlideWithShapes.pptx`, 'shapes')
39-
.importTemplate(`${templateFolder}/SlideWithGraph.pptx`, 'graph')
35+
.importTemplate(`SlideWithShapes.pptx`, 'shapes')
36+
.importTemplate(`SlideWithGraph.pptx`, 'graph')
37+
.importTemplate(`SlideWithImages.pptx`, 'images')
4038

4139
// addSlide takes two arguments: The first will specify the source presentation's
4240
// label to take the template from, the second will set the slide number to require.
4341
pres.addSlide('graph', 1)
4442
.addSlide('shapes', 1)
43+
.addSlide('images', 2)
4544

4645
// Finally, we want to write the output file.
47-
pres.write(`${outputFolder}/myPresentation.pptx`)
46+
pres.write(`myPresentation.pptx`)
4847
```

0 commit comments

Comments
 (0)