Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code snippets for converting MOBI to EPUB using C# .NET
Code snippets for converting MOBI to EPUB using Aspose.Words Cloud SDK For .NET
// Get ClientID from
string clientSecret = "caac6e3d4a4724b2feb53f4e460eade3";
string clientID = "4ccf1790-accc-41e9-8d18-a78dbb2ed1aa";
// create an instance of Configuration while providing your Client credentials
var config = new Configuration{ ClientId = clientID, ClientSecret = clientSecret };
// initialize WordsApi instnace using Configuration argument
var wordsApi = new WordsApi(config);
String inputFile = "";
String resultant = "conveted.epub";
String format = "EPUB";
using (var inputStream = new FileStream("/Users/nshahbaz/Downloads/" + inputFile, FileMode.Open))
// create file upload reqest instance
var uploadFileRequest = new UploadFileRequest(inputStream, inputFile);
// upload MOBI file to Cloud storage
// Create DocumentWithFormatRequest instance using input file, output format
// and resultant EPUB file name as arguments
var response = new GetDocumentWithFormatRequest(inputFile, format, null, null, null, null, resultant);
// initiate the document conversion operation
Stream result = wordsApi.GetDocumentWithFormat(response);
if (result != null && result.Equals("OK"))
Console.WriteLine("Successfully converted MOBI to EPUB !");
catch (Exception ex)
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment