How to convert ODS to PDF in C# .Net Framework

Trying to set up conversion between ODS and PDF is a great way to get some early gray hairs, a fact which I can attest to personally. But fret not, I come to you today bearing hope. By the end of this post, you will have an easy and reliable method that you can use to convert between document types in real time.

First up, we have our client package installation. Paste this command into NuGet’s console:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

Following that, all we have to do is call our ODS to PDF conversion function using an API instance, as you see demonstrated below:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class ConvertDocumentOdsToPdfExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new ConvertDocumentApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.try{// Convert ODS Spreadsheet to PDFbyte[] result = apiInstance.ConvertDocumentOdsToPdf(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentOdsToPdf: " + e.Message );}}}}


There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.