Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert PowerPoint to PDF using REST API in Ruby
# PPTX to PDF Conversion with Watermark in Ruby
# Create necessary API instances
@apiInstance = GroupDocsConversionCloud::ConvertApi.from_keys(@app_sid, @app_key)
# Prepare convert settings
@watermark = GroupDocsConversionCloud::WatermarkOptions.new
@watermark.text = "Confidential Draft Statement"
@watermark.color = "Red"
@watermark.width = 100
@watermark.height = 100
@watermark.background = false
@watermark.bold = true;
@watermark.top = 300;
@watermark.left = 200;
@settings = GroupDocsConversionCloud::ConvertSettings.new
@settings.file_path = "pptx-to-pdf/5pages.pptx"
@settings.format = "pdf"
@convertOptions = GroupDocsConversionCloud::PdfConvertOptions.new
@convertOptions.watermark_options = @watermark
@settings.convert_options = @convertOptions
@settings.output_path = "pptx-to-pdf"
# Convert Document with watermark
result = @apiInstance.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(@settings))
# Convert PowerPoint to PDF using REST API in Ruby
# Create Conversion API instance
@apiInstance = GroupDocsConversionCloud::ConvertApi.from_keys(@app_sid, @app_key)
# Initialize convert settings
@settings = GroupDocsConversionCloud::ConvertSettings.new
@settings.file_path = "pptx-to-pdf/powerpoint-slides.pptx"
@settings.format = "pdf"
# Set Presentation Conversion LoadOptions
@loadOptions = GroupDocsConversionCloud::PresentationLoadOptions.new
@loadOptions.hide_comments = true
@settings.load_options = @loadOptions
@settings.output_path = "pptx-to-pdf"
# Convert PPTX to PDF
result = @apiInstance.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(@settings))
puts("PowerPoint presentation successfully converted to PDF")
# Convert Range of Pages from PPTX to PDF in Ruby
# Create necessary API instances
@apiInstance = GroupDocsConversionCloud::ConvertApi.from_keys(@app_sid, @app_key)
# Prepare convert settings
@settings = GroupDocsConversionCloud::ConvertSettings.new
@settings.file_path = "pptx-to-pdf/powerpoint-slides.pptx"
@settings.format = "pdf"
@convertOptions = GroupDocsConversionCloud::PdfConvertOptions.new
@convertOptions.from_page = 2
@convertOptions.pages_count = 2
@settings.convert_options = @convertOptions
@settings.output_path = "pptx-to-pdf"
# Finally convert range of pages
result = @apiInstance.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(@settings))
# Convert Specific Pages of PPTX to PDF in Ruby
# Create necessary API instances
@apiInstance = GroupDocsConversionCloud::ConvertApi.from_keys(@app_sid, @app_key)
# Prepare convert settings
@settings = GroupDocsConversionCloud::ConvertSettings.new
@settings.file_path = "pptx-to-pdf/powerpoint-slides.pptx"
@settings.format = "pdf"
@convertOptions = GroupDocsConversionCloud::PdfConvertOptions.new
@convertOptions.pages = [1, 5]
@settings.convert_options = @convertOptions
@settings.output_path = "pptx-to-pdf"
# Convert specific pages to PDF
@response = @apiInstance.convert_document(GroupDocsConversionCloud::ConvertDocumentRequest.new(@settings))

We can easily convert PowerPoint PPTX to PDF documents programmatically on the cloud. In this article, you will learn how to convert PowerPoint presentation to PDF using a REST API in Ruby.

The following topics are covered in this article:

  1. PowerPoint to PDF Conversion REST API and Ruby SDK
  2. Convert PowerPoint to PDF using REST API in Ruby
  3. PPTX to PDF Conversion with Watermark using Ruby
  4. Convert Range of Pages from PPTX to PDF in Ruby
  5. Convert Specific Pages of PPTX to PDF in Ruby
  6. Online PPTX to PDF Converter for Free
# Load the gem in your ruby application for http://api.groupdocs.cloud
require 'groupdocs_conversion_cloud'
# Get your client_id and client_secret from https://dashboard.groupdocs.cloud after free registration.
@app_sid = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
@app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment