Create PowerPoint (PPTX) or PDF file on Linux or macOS

GemBox.Presentation is a standalone .NET component with cross-platform support, it can be used on non-Windows platforms like Linux and macOS.

The following example shows how you can create a PowerPoint presentation and a PDF file using GemBox.Presentation on Linux (Ubuntu).

Generated PowerPoint presentation from .NET Core application running on Linux (Ubuntu)
Screenshot of PowerPoint file created with .NET Core on Linux

Prerequisites

After installing the requirements listed above you can follow these steps that show how you can easily use a Visual Studio Code (VS Code) to create a simple Console project and a C# code that generates a PPTX file.

1. Open a project folder

  • Open VS Code.
  • Click "Open Folder" on the EXPLORER panel.
  • Select the folder you want your console project to be in, for instance a folder named GemBoxExample.
Selecting the folder you want your console project to be in
Screenshot of Visual Studio Code folder selection

2. Create a new console project

  • Open Integrated Terminal in VS Code by clicking "View" > "Terminal" or using CTRL + ` shortcut.
  • In the terminal window execute following command: dotnet new console
  • This command will create a code file (Program.cs) and a project file (GemBoxExample.csproj) inside the opened folder.
Creating a C# console project
Screenshot of Visual Studio Code new console command

3. Edit project files

  • Add a reference to GemBox.Presentation and its dependencies in GemBoxExample.csproj file:
    <ItemGroup>
        <PackageReference Include="GemBox.Presentation" Version="*" />
        <PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="*" />
        <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="*" />
    </ItemGroup>
  • Edit C# code in Program.cs file:
    using GemBox.Presentation;
    
    class Program
    {
        static void Main()
        {
            // If using the Professional version, put your serial key below.
            ComponentInfo.SetLicense("FREE-LIMITED-KEY");
    
            var presentation = new PresentationDocument();
    
            var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);
    
            var textBox = slide.Content.AddTextBox(ShapeGeometryType.Rectangle, 2, 2, 5, 4, LengthUnit.Centimeter);
    
            var paragraph = textBox.AddParagraph();
    
            paragraph.AddRun("Hello World!");
    
            presentation.Save("Output.pptx");
            presentation.Save("Output.pdf");
        }
    }

4. Run the console project

  • In the terminal window execute following command: dotnet run
  • This command will run your Console application and create a PowerPoint presentation (Output.pptx) and a PDF file (Output.pdf) that you open in any PowerPoint and PDF applications.
Running a C# console project
Screenshot of Visual Studio Code run command

Using full functionality of GemBox.Presentation on Linux host requires adjustments explained in detail on Supported Platforms help page.

See also


Next steps

GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Download Buy