npm.io
0.0.4 • Published yesterday

@arcsin1/html2pptx

Licence
Apache-2.0
Version
0.0.4
Deps
2
Size
208 kB
Vulns
0
Weekly
0

@arcsin1/html2pptx

Convert an HTML slide page into an editable PPTX document. It provides HTML extraction scripts, normalization, and OOXML writing without depending on Electron.

Install

pnpm add @arcsin1/html2pptx

Usage

import {
  buildHtmlToPptxExtractScript,
  generatePptx,
  normalizeExtractedHtmlToPptxSlide,
} from '@arcsin1/html2pptx'

const rawSlide = await browserRuntime.evaluate(
  buildHtmlToPptxExtractScript({ pageWidthPx: 1600, pageHeightPx: 900 })
)
const slide = normalizeExtractedHtmlToPptxSlide(rawSlide, 'Overview')

const pptx = generatePptx({
  title: 'Deck',
  slides: [slide]
})

When a caller already captures the source page as a raster background, pass unsupportedTransformStrategy: 'raster-fallback' to keep rotations, skew, 3D transforms, and reflections in that background instead of emitting an editable approximation. The default remains 'native' so this standalone API does not silently omit transformed content.

pptx is a Uint8Array containing a standards-compliant .pptx Open Packaging Convention ZIP. Save it in a browser, Worker, server, or Electron application. For Node.js file output, import writeHtmlToPptx from @arcsin1/html2pptx/node.

License

Apache-2.0

Keywords