How to Convert ODT to PNG in C# .Net Framework
1 min readAug 1, 2020
There are few tasks more arduous than dealing with file format conversion between document and image. Not only are there a lot of required steps, but each of them is challenge unto itself. If you would rather not dive into that swamp of tedium, then I have just the solution you are looking for. It’s quick, easy, and requires almost no coding whatsoever.
First step, run this command for package manager:
Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8
Once our library is installed, you can go ahead with calling our ODT to PNG conversion function with this sample code here:
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 ConvertDocumentOdtToPngExample{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 ODT Text File to PNG image arrayOdtToPngResult result = apiInstance.ConvertDocumentOdtToPng(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentOdtToPng: " + e.Message );}}}}
And that’s it! Yup, you’re done