0.0.2 • Published 7 months ago
pptx-in-html-out v0.0.2
⚙️ PPTX In HTML Out
Convert PowerPoint presentations to HTML with high fidelity.
Installation
npm install pptx-in-html-out
Usage
import fs from 'fs/promises';
import { PPTXInHTMLOut } from 'pptx-in-html-out';
// Read your PPTX file into a buffer
const pptxBuffer = await fs.readFile('presentation.pptx');
// Create converter instance with buffer
const converter = new PPTXInHTMLOut(pptxBuffer);
// Convert to HTML
const html = await converter.toHTML();
console.log(html);
// Or write to a file
await fs.writeFile('output.html', html);
Features
- High-fidelity conversion of PowerPoint presentations to HTML
- OCR support for text extraction from images
- Preserves images, shapes, and text formatting
- Responsive output that works across devices
- Modern ESM package
API
PPTXInHTMLOut
Main class for converting PPTX files to HTML.
Constructor
const converter = new PPTXInHTMLOut(pptxBuffer);
pptxBuffer
: Buffer containing the PPTX file data
Methods
toHTML(options)
Converts the presentation to HTML.
Parameters:
options
(optional): Configuration objectincludeStyles
(boolean, default: true): Whether to include default styles in the output HTML
// With default styles
const html = await converter.toHTML();
// Without default styles (for custom styling)
const html = await converter.toHTML({ includeStyles: false });
Returns: Promise<string>
- The generated HTML content
Example
See the example.js
file in the root of this project for an additional example that you can run.
License
MIT