New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pptx-template-engine

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pptx-template-engine

Generate PPTX files from templates using semantic text and image placeholders.

latest
npmnpm
Version
0.4.3
Version published
Maintainers
1
Created
Source

📦 pptx-template-engine

npm version npm downloads license

Generate PowerPoint (PPTX) reports dynamically using templates with semantic text and image placeholders.

powerpoint, pptx, pptx-generator, powerpoint-generator, pptx-template, report-generator, automated-reports, office-open-xml, ooxml, node-pptx, browser-pptx

✨ Overview

pptx-template-engine is a lightweight JavaScript/TypeScript library for automated PowerPoint report generation.

It works with a pre-designed PPTX template and replaces:

  • 📝 Text placeholders like {company_name}
  • 🖼️ Image placeholders defined using Alt Text like chart:sales_chart

Unlike index-based approaches, this library uses semantic keys, making templates stable even when slides or layouts change.

🚀 Features

  • 📝 Text replacement using {placeholder} syntax
  • 🖼️ Image replacement using Alt Text (chart:key)
  • 🧠 Semantic placeholders (no slide/image indexes)
  • ⚙️ Works in Node.js and Browsers
  • 🖥️ CLI support (pptx-generate, pptx-lint)
  • 🧪 Template validation via manifest
  • 🔄 Stable binary handling (Uint8Array)
  • 📦 JavaScript & TypeScript support

📥 Installation

npm install pptx-template-engine

🧠 How It Works

  • Design a PowerPoint (.pptx) template
  • Add text placeholders like {report_month}
  • Add image placeholders using Alt Text (e.g. chart:sales_chart)
  • Generate the final PPTX using code or CLI

🧩 Creating a PPTX Template

Text placeholders

Use placeholders directly in PowerPoint text boxes:

{company_name}
{report_month}
{total_sales}

Image placeholders (IMPORTANT)

  • Insert a placeholder image (PNG or JPG)
  • Right-click → Edit Alt Text
  • Set the description to:
chart:sales_chart

Supported formats:

  • ✅ PNG
  • ✅ JPG
  • ❌ EMF / WMF (vector images not supported)

🧪 Node.js Example

const fs = require("fs");
const { generatePPT } = require("pptx-template-engine");

(async () => {
  const template = fs.readFileSync("./template.pptx");
  const chart = fs.readFileSync("./sales-chart.png");

  const pptx = await generatePPT({
    template,
    text: {
      company_name: "Acme Corporation",
      report_month: "December 2025",
      total_sales: "$1.2M"
    },
    images: {
      sales_chart: chart
    }
  });

  fs.writeFileSync("sales-report.pptx", Buffer.from(pptx));
})();

🌐 Browser Example

import { generatePPT } from "pptx-template-engine";

const pptx = await generatePPT({
  template: templateArrayBuffer,
  text: {
    company_name: "Acme Corporation",
    report_month: "December 2025"
  },
  images: {
    sales_chart: chartBlob
  }
});

const blob = new Blob([pptx], {
  type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
});

🖥️ Node Convenience API

const { generatePPTFromFile } = require("pptx-template-engine/node");

await generatePPTFromFile({
  templatePath: "./template.pptx",
  outputPath: "./report.pptx",
  text: require("./text.json"),
  images: require("./images.json"),
  strict: true
});

🧾 CLI Usage

pptx-generate   --template template.pptx   --out report.pptx   --text text.json   --images images.json   --strict
pptx-lint --template template.pptx --manifest template.manifest.json

📄 Template Manifest Example

{
  "text": ["company_name", "report_month", "total_sales"],
  "images": ["sales_chart"]
}

⚙️ API Reference

generatePPT(options): Promise<Uint8Array>

📄 License

MIT

Keywords

pptx

FAQs

Package last updated on 15 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts