# @office-open/odp ![npm version](https://img.shields.io/npm/v/@office-open/odp) ![npm downloads](https://img.shields.io/npm/dw/@office-open/odp) ![npm license](https://img.shields.io/npm/l/@office-open/odp) > Generate and parse OpenDocument Presentation (`.odp`) files from canonical `PresentationOptions` JSON with typed ODF-only fields โ€” no Microsoft Office or LibreOffice required. ## Features - ๐Ÿ“ˆ **Canonical Presentation Model** โ€” Read and write the same `PresentationOptions` used by PPTX and PPT - ๐Ÿงพ **Master Page Regions** โ€” Preserve typed ODF headers, footers, and their first/left variants - ๐Ÿงฑ **Slides & Shapes** โ€” Slide layouts, shapes, text bodies, geometry, and transforms - ๐ŸŽจ **Styles** โ€” Graphic, text, paragraph, and page styles - ๐Ÿ–ผ๏ธ **Media & Charts** โ€” Embedded images and typed charts - ๐Ÿงฉ **Structured Errors** โ€” Part, path, element, and reason diagnostics ## Installation ```bash # pnpm pnpm add @office-open/odp # npm npm install @office-open/odp # yarn yarn add @office-open/odp # bun bun add @office-open/odp ``` ## Quick Start ```typescript import { generatePresentation, parsePresentation } from "@office-open/odp"; const odp = await generatePresentation({ slides: [{ children: [] }], }); const options = await parsePresentation(odp); ``` ## API - `generatePresentation(options, output?)` โ€” generate an `.odp` package from `OdpPresentationOptions` as `Promise` (`Uint8Array` by default); `generatePresentationSync` covers synchronous output and `generatePresentationStream` returns a `ReadableStream` - `parsePresentation(data)` โ€” parse bytes, Base64/data-URL strings, `Blob`, or `ReadableStream` into `OdpPresentationOptions` (the canonical `PresentationOptions` ODF overlay) as `Promise`; `parsePresentationSync` covers synchronous parsing (rejects `Blob` and `ReadableStream` inputs) - `patchPresentation({ data, commands })` โ€” parse an ODP package, apply ordered canonical edits, and regenerate it - `OdpParseError` / `OdpGenerateError` โ€” structured failures with part, path, element, and reason diagnostics Every input is a plain JSON object (`PresentationOptions` and its option types). The full typed API reference lives in the [documentation](https://www.office-open.com/en/getting-started/more-formats). ## Errors and Limitations - Invalid ZIP containers, unexpected mimetypes, truncated XML, and unknown content-model elements throw `OdpParseError`; unrepresentable canonical presentation output throws `OdpGenerateError`. - Generated output targets ODF 1.3. - Patching edits the canonical model and preserves package overlays unless they are explicitly changed. ## Documentation - [Documentation](https://www.office-open.com/en/getting-started/more-formats) โ€” additional format guides and examples - [Report Issues](https://github.com/DemoMacro/office-open/issues) โ€” bug reports and feature requests ## Related Packages - [office-open](https://www.npmjs.com/package/office-open) โ€” all formats + CLI + AI SDK tools in one install - [@office-open/pptx](https://www.npmjs.com/package/@office-open/pptx) โ€” PowerPoint (.pptx) generation and parsing - [@office-open/ppt](https://www.npmjs.com/package/@office-open/ppt) โ€” legacy PowerPoint (.ppt) parsing ## License - [MIT](https://github.com/DemoMacro/office-open/blob/main/LICENSE) ยฉ [Demo Macro](https://www.demomacro.com/)