# How to Export OpenMAIC Content as a PowerPoint (.pptx) File

> Easily export OpenMAIC content to PowerPoint (.pptx) files using the built-in export pipeline and the buildPptxBlob function. Transform your slides, media, and annotations into shareable presentations.

- Repository: [MAIC/OpenMAIC](https://github.com/THU-MAIC/OpenMAIC)
- Tags: how-to-guide
- Published: 2026-09-11

---

**OpenMAIC ships with a built-in PPTX export pipeline that transforms workspace slides, media, and annotations into downloadable `.pptx` files using the pptxgenjs library through the `buildPptxBlob` function.**

The THU-MAIC/OpenMAIC repository provides a comprehensive framework for converting interactive MAIC workspaces into standard PowerPoint presentations. Understanding how to export OpenMAIC content as a PowerPoint (.pptx) file enables developers to integrate automated slide generation into custom workflows, conversational agents, or direct user interfaces. The system implements a three-layer architecture that handles everything from slide creation to resource bundling.

## Understanding the PPTX Export Architecture

According to the THU-MAIC/OpenMAIC source code, the export system separates concerns across three distinct layers to ensure modularity and testability.

### Export Core ([`lib/export/use-export-pptx.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/use-export-pptx.ts))

The primary export logic resides in [`lib/export/use-export-pptx.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/use-export-pptx.ts), where the `buildPptxBlob` function serves as the main entry point. This module instantiates the `PptxGenJS` class, iterates through the workspace model associated with a given `sessionId`, and translates each MAIC slide into a PPTX slide using `pptx.addSlide()`.

The mapping process converts MAIC components into their PPTX equivalents:
- **Text boxes** render via `addText` calls using coordinate data from the workspace model.
- **Images** embed through `addImage` after conversion to data-URL blobs to ensure portability.
- **Shapes** draw via `addShape` methods with layout-preserving positioning.

After processing all slides, the exporter calls `pptx.write({ outputType: 'blob' })` to generate the final Blob object for download.

### Resource Packaging ([`lib/export/resource-pack.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/resource-pack.ts))

When workflows require bundling auxiliary assets, [`lib/export/resource-pack.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/resource-pack.ts) packages the generated PPTX with embedded media into a single ZIP archive. This ensures users download one comprehensive file containing both the presentation and any related resources.

### Skill and UI Integration (`skills/agent-runtime/pptx-import/`)

The `pptx-import` skill defined in [`skills/agent-runtime/pptx-import/skill.yml`](https://github.com/THU-MAIC/OpenMAIC/blob/main/skills/agent-runtime/pptx-import/skill.yml) exposes export functionality to the conversational agent runtime. Frontend components implement this capability through actions like the "Export → PowerPoint" button, which triggers calls to the internal `/api/export/pptx` endpoint.

## Programmatic Export Methods

Developers can invoke the export pipeline through multiple interfaces depending on their integration requirements.

### Direct Function Invocation

Import `buildPptxBlob` to generate PPTX files server-side or in custom scripts:

```typescript
import { buildPptxBlob } from '@/lib/export/use-export-pptx';

async function exportCurrentWorkspace(sessionId: string) {
  // Generates Blob containing the complete PPTX file
  const pptxBlob = await buildPptxBlob({ sessionId });
  
  // Trigger browser download client-side
  const url = URL.createObjectURL(pptxBlob);
  const anchor = document.createElement('a');
  anchor.href = url;
  anchor.download = 'my-workspace.pptx';
  anchor.click();
  URL.revokeObjectURL(url);
}

```

### REST API Endpoint

For decoupled clients, call the HTTP endpoint with the session identifier:

```typescript
async function downloadViaApi(sessionId: string) {
  const response = await fetch(`/api/export/pptx?session=${sessionId}`);
  if (!response.ok) throw new Error('Export failed');
  
  const blob = await response.blob();
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = url;
  link.download = 'workspace.pptx';
  link.click();
  URL.revokeObjectURL(url);
}

```

## Export Method Comparison

Select the integration path based on your technical constraints and deployment context.

**Direct Function Call** (`buildPptxBlob`): Best suited for server-side rendering pipelines or custom scripts requiring workspace manipulation before export. This method requires direct access to the OpenMAIC library internals and the Node.js environment.

**REST API Endpoint** (`/api/export/pptx`): Ideal for browser-based applications and third-party integrations. This approach handles session management automatically and streams the generated Blob through standard HTTP protocols.

**Skill-Based Export** (`pptx-import` skill): Optimized for conversational AI workflows where exports trigger automatically following chat-based editing sessions. The skill interfaces with the runtime to generate and attach PPTX files to agent responses.

## Media Handling and Data Integrity

The export pipeline in [`lib/export/use-export-pptx.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/use-export-pptx.ts) ensures all media assets survive transit by converting images to data-URL blobs before embedding them via `addImage`. This technique guarantees that presentations function correctly offline without external dependencies. The test suite in [`tests/export/pptx-media-fallback.test.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/tests/export/pptx-media-fallback.test.ts) validates this behavior, verifying that fallback mechanisms activate when assets are missing or corrupted.

## Summary

- The core export logic lives in [`lib/export/use-export-pptx.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/use-export-pptx.ts), utilizing `pptxgenjs` to convert MAIC slides to PPTX format.
- Call `buildPptxBlob({ sessionId })` to programmatically generate PPTX files from active workspace sessions.
- Use the `/api/export/pptx` endpoint for HTTP-based export requests from browser clients.
- The `pptx-import` skill enables conversation-driven export workflows within the agent runtime.
- Media assets embed as data-URL blobs to ensure complete file portability.

## Frequently Asked Questions

### What library does OpenMAIC use for PowerPoint generation?

OpenMAIC uses **pptxgenjs** according to the source code in [`lib/export/use-export-pptx.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/lib/export/use-export-pptx.ts). This library provides the `PptxGenJS` class with methods including `addSlide()`, `addText()`, `addImage()`, and `write()` that the exporter leverages to construct the final `.pptx` file structure.

### Can I export OpenMAIC content without using the UI button?

Yes. Import `buildPptxBlob` from `@/lib/export/use-export-pptx` and invoke it with a valid `sessionId` to generate a Blob programmatically. Alternatively, send an HTTP request to `/api/export/pptx?session=${sessionId}` to retrieve the file via the REST API.

### How does OpenMAIC handle images during PPTX export?

The exporter converts image assets to data-URL blobs before calling `addImage`. This process ensures all media resides within the `.pptx` file itself rather than linking to external URLs, guaranteeing the presentation displays correctly when shared or viewed offline.

### Where are the PPTX export tests located?

The test suite resides in [`tests/export/pptx-media-fallback.test.ts`](https://github.com/THU-MAIC/OpenMAIC/blob/main/tests/export/pptx-media-fallback.test.ts). These tests verify that media embeds correctly into slides and that fallback mechanisms function properly when assets are unavailable or corrupted during the export process.