1. Products
  2.   Presentation
  3.   Ruby
  4.   Ruby-PPTX
 
  

Create New Presentations, Add Images & Slides via Free Ruby API

A Leading Open Source Ruby PPTX Library to Create, Read, Edit, & Manipulate PowerPoint PPTX Presentation. Add & Delete Slides, Text, Images via Free Ruby API

What is Ruby-PPTX Library?

PowerPoint automation is becoming essential for businesses, educators, and content creators who need to generate presentations at scale. Creating and manipulating PowerPoint presentations in a programmatic way has long been a task dominated by heavy libraries, Microsoft dependencies, or platform-specific tooling. But for Ruby developers, the Ruby-PPTX gem changes that. It’s a lightweight, intuitive, open-source library that lets you generate .pptx files right from your Ruby application — no PowerPoint, no Office suite, no fuss. There are numerous features part of the library, such as creating presentation from the scratch, create & manage slides in presentation, insert text and images, apply animation and styles to slides, export slide to images and many more.

Ruby-PPTX is an MIT-licensed Ruby library created by Nuvyu that allows software developers to create PowerPoint presentations using a clean Ruby API. The gem generates compliant .pptx files (Office Open XML format) from scratch using Ruby’s native file system capabilities. It requires no external dependencies, making it ideal for developers who want full control over slide generation within their Ruby apps or web frameworks like Ruby on Rails. By integrating the Ruby-PPTX library, developers can create more consistent, professional presentations by saving countless hours of manual PowerPoint work and integrate PowerPoint generation into larger workflows with ease.

Previous Next

Getting Started with 'Ruby-PPTX'

The recommend way to install Ruby-PPTX Ruby library is using Ruby gem. Please use the following command for a smooth installation.

Install 'Ruby-PPTX' via Ruby gem

gem install ruby-pptx 

Install Ruby-PPTX Ruby library via GitHub

git clone https://github.com/nuvyu/ruby-pptx.git  

Create Presentations from Scratch via Ruby

Then open source Ruby-PPTX library makes it straightforward to create a new presentations from the scratch inside Ruby applications. The library has provided several important features for handling PowerPoint PPTX presentations such as inserting new slides, adding table to slides, specifying layout and title of the slide, inserting images to slides, adding text , deleting unwanted slides, applying styles and formatting and many more. Here is a simple example that demonstrates how to create a simple PPTX presentation inside Ruby application.

How to Create a Simple PPTX Presentation using Ruby API?

require 'ruby-pptx'

presentation = RubyPPTX::Presentation.new

presentation.add_slide do |slide|
  slide.add_text('Welcome to Ruby-PPTX!', x: 100, y: 100, font_size: 32, color: '0000FF')
end

presentation.save('welcome.pptx')

Add Slides with Different Layouts to PPTX File via Ruby

The Ruby-PPTX library opens up a world of possibilities for Ruby developers looking to automate PowerPoint generation and handle slides inside it. The library makes it easy for software developers to add slides with various predefined layouts, add titles for slides, export slide’s contents, export slide to image, and delete slides inside Ruby applications. Here is a simple example that shows how software developers can add slides with various predefined layouts using Ruby commands.

How to Add Slides with Predefined Layouts inside Ruby App?

# Title slide
title_slide = presentation.add_slide(:title)

# Title and content slide
content_slide = presentation.add_slide(:title_content)

# Two content slide
two_content_slide = presentation.add_slide(:two_content)

# Comparison slide
comparison_slide = presentation.add_slide(:comparison)

# Blank slide
blank_slide = presentation.add_slide(:blank)

Work With Text & Images in PPTX Files via Ruby

The open source Ruby-PPTX library has provided complete functionality for working with text and images inside PowerPoint PPTX presentation using Ruby Library. With just a couple of lines of code, software developers can embed external images directly into slides, insert text, apply styles to existing text, remove unwanted part of the content, and so on. The following example shows how developers can insert an image to a presentation’s slide inside Ruby applications.

How to Insert an Image to Presentation’s Slide via Ruby API?

content_slide.add_image("/path/to/image.png", width: 300, height: 200, position: {x: 100, y: 150})