{"library":"pptxgenjs","title":"PptxGenJS - Generate PowerPoint Presentations","description":"PptxGenJS is a comprehensive JavaScript library designed for programmatically generating professional PowerPoint presentations (PPTX files) directly from various JavaScript environments, including Node.js, React, Angular, Vite, Electron, and modern web browsers. The library is currently at version 4.0.1 and maintains a fairly active release cadence, with minor and patch versions released every few weeks to months. It differentiates itself by allowing the creation of complex slides with text, tables, shapes, images, and charts without requiring a Microsoft PowerPoint installation or license. Key features include defining custom Slide Masters, supporting SVGs, animated GIFs, YouTube embeds, RTL text, and Asian fonts. It also offers a unique HTML to PowerPoint conversion for tables and provides full TypeScript definitions, ensuring a robust development experience. Presentations created are standards-compliant Open Office XML (OOXML) files compatible with major office suites like Microsoft PowerPoint, Apple Keynote, and LibreOffice Impress.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install pptxgenjs"],"cli":null},"imports":["import PptxGenJS from 'pptxgenjs'","import PptxGenJS, { ISlide, IShape } from 'pptxgenjs'","<script src=\"https://cdn.jsdelivr.net/gh/gitbrent/pptxgenjs/dist/pptxgen.bundle.js\"></script>\n// Then access via window.PptxGenJS or simply PptxGenJS"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import PptxGenJS from 'pptxgenjs';\n\nasync function createPresentation() {\n  let pptx = new PptxGenJS();\n  \n  // Define a Slide Master for consistent branding\n  pptx.defineSlideMaster({\n    title: 'MASTER_TITLE',\n    bkgd: 'F1F1F1',\n    objects: [\n      { rect: { x: 0, y: 0, w: '100%', h: 0.75, fill: { color: 'E6E6E6' } } },\n      { text: { text: 'PptxGenJS Demo', options: { x: 0.5, y: 0.25, w: 5, h: 0.5, fontSize: 24 } } },\n      { image: { x: 9.5, y: 0.1, w: 0.75, h: 0.75, path: 'https://raw.githubusercontent.com/gitbrent/PptxGenJS/master/docs/assets/images/logo.png' } }\n    ]\n  });\n\n  let slide = pptx.addSlide({ masterName: 'MASTER_TITLE' });\n\n  slide.addText(\n    'Hello PptxGenJS! This is a simple example.',\n    { x: 0.5, y: 1.5, w: 12, h: 1, fontSize: 36, color: '363636', align: 'center' }\n  );\n\n  slide.addTable([\n    [{ text: 'Header 1' }, { text: 'Header 2' }],\n    ['Row 1, Cell 1', 'Row 1, Cell 2'],\n    ['Row 2, Cell 1', 'Row 2, Cell 2']\n  ], {\n    x: 1, y: 3,\n    w: 10, colW: [5, 5],\n    border: { pt: 1, color: 'CCCCCC' },\n    fill: 'F9F9F9',\n    align: 'center',\n    valign: 'middle'\n  });\n\n  // In a browser, this will trigger a download\n  // In Node.js, you would typically use save() to write to a file system\n  if (typeof window !== 'undefined') {\n    pptx.writeFile({ fileName: 'MyPresentation.pptx' });\n  } else {\n    // Node.js example: save to a file\n    // await pptx.writeFile({ fileName: 'MyPresentation.pptx' });\n    console.log('Presentation generated. Run in browser to download.');\n  }\n}\n\ncreatePresentation();","lang":"typescript","description":"This quickstart demonstrates how to instantiate PptxGenJS, define a slide master for branding, add a new slide using that master, then insert text and a basic table. Finally, it shows how to trigger a file download in a browser or logs a message for Node.js environments.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}