1. Products
  2.   Presentation
  3.   Node.js
  4.   HTML2PPTX
 
  

HTML Conversion to PowerPoint PPTX via Free Node.js Library

A Useful Open Source Node.js PowerPoint Library to Load and Convert Simple As Well As Advanced HTML Code Conversion to PowerPoint PPTXs Presentations.

What is HTML2PPTX?

Converting HTML content into PowerPoint presentations has traditionally been a tedious, manual process. HTML2PPTX changes everything by providing an automated solution that transforms any HTML file into a professional PowerPoint presentation with just one command. This powerful Node.js library and command-line tool eliminates the need for manual intervention, preserving your content's styling, layout, and structure seamlessly. The library supports automatic conversion with zero configuration, advanced layout handling, CSS transformation, image and SVG conversion, hyperlink preservation, and much more.

HTML2PPTX is an open-source Node.js library designed to automatically convert HTML files into PowerPoint presentations (.pptx format). It is a client-side JavaScript library that parses specially structured HTML and CSS with ease. Whether you're a developer building automated reporting systems, a designer converting web mockups to presentations, or a content creator looking to repurpose web content, HTML2PPTX provides a straightforward solution that works right out of the box. The tool intelligently parses HTML structure, extracts CSS styling, and maps web elements to their PowerPoint equivalents—all while maintaining the visual fidelity of your original design.

Previous Next

Getting Started with HTML2PPTX

The recommend way to install HTML2PPTX is using npm. Please use the following command for a smooth installation.

Install HTML2PPTX via npm

 npm install html2pptx
You can also download it directly from Aspose product release page.

Simple HTML Conversion to PPTX in Node.js

The HTML2PPTX library has included powerful features for loading and converting HTML code into PowerPoint PPTX presentation inside Node.js apps. The most straightforward programmatic approach uses the convertHTML2PPTX function. This function returns a Promise, making it perfect for asynchronous workflows. The success callback receives information about the generated presentation, while errors are caught and can be handled appropriately.

How to Convert Simple HTML Code to PowerPoint PPTX File via Node.js?

How to Convert Siple  HTML 
const { convertHTML2PPTX } = require('html2pptx');

convertHTML2PPTX('input.html', 'output.pptx')
  .then(result => {
    console.log('Conversion successful!', result);
  })
  .catch(error => {
    console.error('Conversion failed:', error);
  });

Advanced HTML Conversion to PPTX inside Node.js

The HTML2PPTX's library has included support for simple as well as advanced and more control HTML conversion to PPTX Files. For more control over the conversion process, create an HTML2PPTX instance with custom settings. This approach lets you define slide dimensions that match specific presentation requirements. The default 16:9 aspect ratio works well for most modern displays, but you can adjust these values for different formats like 4:3 for older projectors.

How to Perform Advanced HTML Conversion into PPTX Presentation inside Node.js Apps?

const { HTML2PPTX } = require('html2pptx');

const converter = new HTML2PPTX({
  slideWidth: 10,              // Width in inches
  slideHeight: 5.625,          // Height in inches (16:9 aspect ratio)
  background: { color: 'FFFFFF' }  // White background
});

converter.convert('input.html', 'output.pptx')
  .then(result => {
    console.log('Custom presentation created!', result);
  })
  .catch(error => {
    console.error('Error during conversion:', error);
  });

Powerful Styling with CSS inside Node.js

One of HTML2PPTX's most potent features is its extensive support for CSS. You can control the layout, appearance, and positioning of every element on your slide just as you would when styling a webpage. This CSS gradient can be used for the background and flexbox to center the caontent vertically and horizontally with ease. The following example demonstrates how users can use the absolute positioning to place a "Confidential" watermark in the bottom-right corner, demonstrating precise control over element placement.

Image and SVG Conversion in Node.js

The open source Node.js Library HTML2PPTX has included complete support for converting PowerPoint presentations. It transforms ‘img ‘ tags into PowerPoint slide images, and also supports ‘svg’ elements: Images embedded in your HTML are automatically extracted and inserted into the PowerPoint presentation. More impressively, HTML2PPTX converts SVG graphics into PowerPoint-native elements, transforming SVG shapes, lines, and text into editable PowerPoint objects rather than flattened images. The following shows the HTML code which can be converted into a slide with the image and vector shape text.

How to Convert HTML Images to PowerPoint Images inside Node.js Apps?

Logo
SVG Example

Advanced Layout Handling

HTML2PPTX supports complex layout systems that modern web development relies on. The tool handles absolute positioning, relative positioning, and flexbox layouts with impressive accuracy. Recent updates have specifically addressed flexbox column layouts, ensuring that all elements render correctly with proper spacing—a critical fix that resolved previous rendering issues.