This gist shows code snippet on how to convert MOBI to EPUB format using Aspose.Words Cloud SDK for .NET.
For more information, please visit
This gist shows code snippet on how to convert MOBI to EPUB format using Aspose.Words Cloud SDK for .NET.
For more information, please visit
Code snippets for converting MOBI to EPUB using Aspose.Words Cloud SDK For .NET |
// Get ClientID from https://dashboard.aspose.cloud/ | |
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 = "famouspaintings.mobi"; | |
String resultant = "conveted.epub"; | |
String format = "EPUB"; | |
try | |
{ | |
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 | |
wordsApi.UploadFile(uploadFileRequest); | |
// 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); | |
} |