pptx-to-pptist
v1.0.2
Published
Convert PPTX files to PPTist JSON format
Maintainers
Readme
pptx-to-pptist
Convert PPTX files to PPTist JSON format.
Installation
npm installLibrary Usage
import { convertPPTXToPPTist } from 'pptx-to-pptist'
const result = await convertPPTXToPPTist('./input.pptx')
console.log(result)
// {
// title: 'Imported Presentation',
// width: 1000,
// height: 562.5,
// theme: { ... },
// slides: [ ... ]
// }Options
const result = await convertPPTXToPPTist('./input.pptx', {
fixedViewport: false, // Use fixed viewport width (default: false)
viewportWidth: 1000, // Viewport width when fixedViewport is true
})CLI Usage
# Convert a file
npx pptx-to-pptist input.pptx -o output.json
# Output to stdout
npx pptx-to-pptist input.pptx --stdout
# With fixed viewport width
npx pptx-to-pptist input.pptx -o output.json --width 1280API Server
Start the API server:
npx pptx-to-pptist-api --port 3000Endpoints
POST /convert
Upload a PPTX file to convert.
Request:
- Content-Type:
multipart/form-data - Body:
file- The PPTX file - Optional:
fixedViewport- Set to "true" for fixed viewport - Optional:
viewportWidth- Viewport width (default: 1000)
Response:
{
"title": "Imported Presentation",
"width": 1000,
"height": 562.5,
"theme": {
"backgroundColor": "#fff",
"themeColors": ["rgb(155, 0, 0)"],
"fontColor": "rgb(51, 51, 51)",
"fontName": "",
"outline": { ... },
"shadow": { ... }
},
"slides": [...]
}Output Format
The output follows the PPTist JSON schema:
interface PPTistPresentation {
title: string
width: number
height: number
theme: SlideTheme
slides: Slide[]
}
interface Slide {
id: string
elements: PPTElement[]
remark?: string
background?: SlideBackground
animations?: PPTAnimation[]
turningMode?: TurningMode
}Development
# Build
npm run build
# Type check
npm run typecheck
# Test
npm run test
# Lint
npm run lintLicense
MIT
