> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# PowerPointPresentation

The deck. Open or create one, then edit it through `slides`, `slideMasters` and the other collections. [Concepts](https://docs.reducto.ai/office/pptx/js-api/concepts.md) explains the model.

## `PowerPointPresentation`

Office.js-shaped facade over a .pptx (`PowerPoint.Presentation`). Handles
are live element references and every edit applies at once: there is no
load()/sync() protocol. Members Office.js lacks are marked as extensions.

Import from `@reductoai/pptx/officejs`.

### PowerPointPresentation properties

| Name | Type | Description |
| - | - | - |
| `pageSetup` | `PageSetup` | read-only |
| `properties` | `DocumentProperties` | read-only |
| `session` | `PptxSession` | read-only |
| `slideMasters` | `SlideMasterCollection` | read-only |
| `slides` | `SlideCollection` | read-only |
| `customShows` | `CustomShowCollection` | read-only Extension (VBA `SlideShowSettings.NamedSlideShows`): the deck's custom shows. |
| `customXmlParts` | `CustomXmlPartCollection` | read-only |
| `embeddedFonts` | `EmbeddedFontCollection` | read-only Extension (VBA `SaveAs` `EmbedTrueTypeFonts`): the font files the deck carries. |
| `fonts` | `PresentationFontCollection` | read-only Extension (VBA `Presentation.Fonts`): the typefaces the deck's text names, and whether each is embedded. |
| `gridDistance` | `number` | Extension (VBA `Presentation.GridDistance`): the grid's spacing in points, 0.72 to 144. |
| `guides` | `GuideCollection` | read-only Extension (VBA `Presentation.Guides`): the drawing guides of the slide view. |
| `id` | `string` | read-only |
| `imageRenderer` | `ImageRenderer \| undefined` | Extension: rasterizes `getImageAsBase64` on a host without the node entry (a browser canvas). |
| `sections` | `SectionCollection` | read-only Extension (VBA `Presentation.SectionProperties`): the slide list's sections. |
| `snapToGrid` | `boolean` | Extension (VBA `Presentation.SnapToGrid`): Grid and Guides > Snap objects to grid. |
| `tags` | `TagCollection` | read-only |
| `title` | `string` | read-only |

### `PowerPointPresentation.create()`

```ts theme={null}
static create(): Promise<PowerPointPresentation>
```

A deck with no slides on PowerPoint's default Office Theme (16:9).

### `PowerPointPresentation.fromBytes()`

```ts theme={null}
static fromBytes(bytes: Uint8Array): Promise<PowerPointPresentation>
```

### `PowerPointPresentation.applySlideMaster()`

```ts theme={null}
applySlideMaster(masterId: string, options?: ApplyTemplateOptions): void
```

Extension (VBA `SlideRange.Design`): a master already in the deck on the given slides (all when absent).

### `PowerPointPresentation.applyTemplateFromBase64()`

```ts theme={null}
applyTemplateFromBase64(
  base64File: string | Uint8Array<ArrayBufferLike>,
  options?: ApplyTemplateOptions,
): Promise<string>
```

Extension (VBA `ApplyTemplate`): the first master of a .pptx or .potx, with its layouts and
theme, on the given slides (all when absent). Each slide moves to the layout of its type, or of
its name for a custom one; a layout with no match is copied. A master no slide uses is dropped.
Returns the master's id.

### `PowerPointPresentation.insertSlidesFromBase64()`

```ts theme={null}
insertSlidesFromBase64(
  base64File: string | Uint8Array<ArrayBufferLike>,
  options?: InsertSlideOptions,
): Promise<string[]>
```

Office.js queues the insert; the facade resolves once it is done, with the new
slides' ids. Without `formatting` the slides keep their source master and theme.

### `PowerPointPresentation.toBytes()`

```ts theme={null}
toBytes(): Promise<Uint8Array<ArrayBufferLike>>
```

## Node additions

### `PowerPointPresentation.create()` (node)

```ts theme={null}
static create(): Promise<PowerPointPresentation>
```

A deck with no slides on PowerPoint's default Office Theme (16:9).

### `PowerPointPresentation.fromBytes()` (node)

```ts theme={null}
static fromBytes(bytes: Uint8Array): Promise<PowerPointPresentation>
```

### `PowerPointPresentation.open()` (node)

```ts theme={null}
static open(path: string): Promise<PowerPointPresentation>
```

### `PowerPointPresentation.save()` (node)

```ts theme={null}
save(path: string): Promise<void>
```

Writes to `path`; the facade never writes the source file in place.

### `PowerPointPresentation.toPdf()` (node)

```ts theme={null}
toPdf(path?: string, options?: ToPdfOptions): Promise<Uint8Array<ArrayBufferLike>>
```

Lays out the current edit state and paints it; writes `path` when given.

### `PowerPointPresentation.toPng()` (node)

```ts theme={null}
toPng(options?: ToPngOptions): Promise<RenderedPng[]>
```

One PNG per slide (or per `pages`, zero-based), from the same IR as `toPdf`.

## `ToPdfOptions`

Import from `@reductoai/pptx/node`.

```ts theme={null}
type ToPdfOptions = RenderPdfOptions & { includeHiddenSlides?: boolean }
```

## `ToPngOptions`

Import from `@reductoai/pptx/node`.

| Name | Type | Description |
| - | - | - |
| `includeHiddenSlides?` | `boolean` | |
| `pages?` | `number[]` | |
| `scale?` | `number` | |

## `PageSetup`

`PowerPoint.PageSetup`: the slide size in points.

Import from `@reductoai/pptx/officejs`.

### PageSetup properties

| Name | Type | Description |
| - | - | - |
| `slideHeight` | `number` | |
| `slideWidth` | `number` | |

### `PageSetup.resize()`

```ts theme={null}
resize(width: number, height: number, scale?: SlideSizeScale): void
```

Extension (Design > Slide Size): sets the size in points and maps every slide onto it.
`EnsureFit` shrinks content to fit a smaller slide; `Maximize` keeps it large and lets it
run past an edge. Layouts and masters stretch to the new size.
