Last active
March 8, 2020 19:23
-
-
Save groupdocscloud/2a7a7a2afe748942748c4b5ae066b233 to your computer and use it in GitHub Desktop.
This Gist contains .NET examples of GroupDocs.Conversion Cloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conversion-CSharp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "html", | |
ConvertOptions = new HtmlConvertOptions | |
{ | |
FromPage = 1, | |
PagesCount = 1, | |
FixedLayout = true | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "jpg", | |
ConvertOptions = new JpgConvertOptions | |
{ | |
FromPage = 1, | |
PagesCount = 2 | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/password-protected.docx", | |
Format = "pdf", | |
LoadOptions = new DocxLoadOptions { Password = "password" }, | |
ConvertOptions = new PdfConvertOptions | |
{ | |
CenterWindow = true, | |
CompressImages = false, | |
DisplayDocTitle = true, | |
Dpi = 1024, | |
FitWindow = false, | |
FromPage = 1, | |
Grayscale = false, | |
ImageQuality = 100, | |
Linearize = false, | |
MarginTop = 5, | |
MarginLeft = 5, | |
Password = "password", | |
UnembedFonts = true, | |
RemoveUnusedStreams = true, | |
RemoveUnusedObjects = true, | |
RemovePdfaCompliance = false | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "ppt", | |
ConvertOptions = new PresentationConvertOptions() | |
{ | |
FromPage = 2, | |
PagesCount = 1 | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "xlsx", | |
ConvertOptions = new SpreadsheetConvertOptions() | |
{ | |
FromPage = 2, | |
PagesCount = 1, | |
Zoom = 150 | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Pdf/sample.pdf", | |
Format = "docx", | |
LoadOptions = new PdfLoadOptions { Password = "", HidePdfAnnotations = true, RemoveEmbeddedFiles = false, FlattenAllFields = true }, | |
ConvertOptions = new DocxConvertOptions(), | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
class Common | |
{ | |
public static string MyAppSid = Common.MyAppSid; | |
public static string MyAppKey = Common.MyAppKey; | |
public static string MyStorage = Common.MyStorage; | |
public static void UploadSampleTestFiles() | |
{ | |
var storageConfig = new Configuration(MyAppSid, MyAppKey); | |
StorageApi storageApi = new StorageApi(storageConfig); | |
FolderApi folderApi = new FolderApi(storageConfig); | |
FileApi fileApi = new FileApi(storageConfig); | |
var path = "..\\..\\..\\Data"; | |
Console.WriteLine("File Upload Processing..."); | |
var dirs = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); | |
foreach (var dir in dirs) | |
{ | |
var relativeDirPath = dir.Replace(path, string.Empty).Trim(Path.DirectorySeparatorChar); | |
var response = storageApi.ObjectExists(new Sdk.Model.Requests.ObjectExistsRequest(relativeDirPath, MyStorage)); | |
if (!response.Exists.Value) | |
{ | |
folderApi.CreateFolder(new Sdk.Model.Requests.CreateFolderRequest(relativeDirPath, MyStorage)); | |
} | |
} | |
var files = Directory.GetFiles(path, "*", SearchOption.AllDirectories); | |
foreach (var file in files) | |
{ | |
var relativeFilePath = file.Replace(path, string.Empty).Trim(Path.DirectorySeparatorChar); | |
var response = storageApi.ObjectExists(new Sdk.Model.Requests.ObjectExistsRequest(relativeFilePath, MyStorage)); | |
if (!response.Exists.Value) | |
{ | |
var fileName = Path.GetFileName(file); | |
var relativeDirPath = relativeFilePath.Replace(fileName, string.Empty).Trim(Path.DirectorySeparatorChar); | |
var fileStream = File.Open(file, FileMode.Open); | |
fileApi.UploadFile(new Sdk.Model.Requests.UploadFileRequest(relativeFilePath, fileStream, MyStorage)); | |
fileStream.Close(); | |
} | |
} | |
Console.WriteLine("File Upload Process Completed."); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var watermark = new WatermarkOptions | |
{ | |
Text = "Sample watermark", | |
Color = "Red", | |
Width = 100, | |
Height = 100, | |
Background = true | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "pdf", | |
ConvertOptions = new PdfConvertOptions | |
{ | |
WatermarkOptions = watermark | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "pdf", | |
ConvertOptions = new PdfConvertOptions | |
{ | |
FromPage = 2, // Page number starts from 1 | |
PagesCount = 2 | |
}, | |
OutputPath = "converted/two-pages.pdf" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/four-pages.docx", | |
Format = "pdf", | |
ConvertOptions = new PdfConvertOptions | |
{ | |
Pages = new List<int?> {1, 3} // Page numbers starts from 1 | |
}, | |
OutputPath = "converted/two-pages.pdf" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", | |
AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to any format (quick convert) request | |
var request = new QuickConvertStreamRequest | |
{ | |
// convert to cells request | |
request = new QuickConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.pdf", Password = "" }, | |
// quick convert format | |
Format = "doc" | |
} | |
}; | |
// convert to specified format | |
var response = apiInstance.QuickConvertToStream(request); | |
Debug.Print(response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi.QuickConvertToStream: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Quick Convert to Any Desired Output Format | |
class Convert_To_Any_Format | |
{ | |
public static void Run(string convertToFormat, ConvertOptions convertOptions) | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = convertToFormat, | |
ConvertOptions = convertOptions, | |
OutputPath = "converted/" + convertToFormat | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document converted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi.QuickConvert: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Quick Convert to Any Desired Output Format with output as iostream | |
class Convert_To_Any_Format_Stream | |
{ | |
public static void Run(string convertToFormat, ConvertOptions convertOptions) | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = convertToFormat, | |
ConvertOptions = convertOptions, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document converted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi.QuickConvert: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Cells with load and save options | |
class Convert_To_Cells | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "xlsx", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new XlsxConvertOptions() { FromPage = 1, PagesCount = 1, Password = "password", UsePdf = false }, | |
OutputPath = "converted/tocells" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Cells with load and save options with output as iostream | |
class Convert_To_Cells_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "xlsx", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new XlsxConvertOptions() { FromPage = 1, PagesCount = 1, Password = "password", UsePdf = false }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Html | |
class Convert_To_Html | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "html", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new HtmlConvertOptions() { FixedLayout = true, UsePdf = true }, | |
OutputPath = "converted/tohtml" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Html with output as iostream | |
class Convert_To_Html_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "html", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new HtmlConvertOptions() { FixedLayout = true, UsePdf = true }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to image/s with load and save options | |
class Convert_To_Images | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "jpeg", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new JpegConvertOptions() { Grayscale = false, FromPage = 1, PagesCount = 1, Quality = 100, RotateAngle = 90, UsePdf = false }, | |
OutputPath = "converted/tojpeg" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to image/s with load and save options with output as iostream | |
class Convert_To_Images_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "jpeg", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new JpegConvertOptions() { Grayscale = false, FromPage = 1, PagesCount = 1, Quality = 100, RotateAngle = 90, UsePdf = false }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to PDF with load and save options | |
class Convert_To_Pdf | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "pdf", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new PdfConvertOptions() | |
{ | |
BookmarksOutlineLevel = 1, | |
CenterWindow = true, | |
CompressImages = false, | |
DisplayDocTitle = true, | |
Dpi = 1024, | |
ExpandedOutlineLevels = 1, | |
FitWindow = false, | |
FromPage = 1, | |
Grayscale = false, | |
HeadingsOutlineLevels = 1, | |
ImageQuality = 100, | |
Linearize = false, | |
MarginTop = 5, | |
MarginLeft = 5, | |
Password = "password", | |
UnembedFonts = true, | |
RemoveUnusedStreams = true, | |
RemoveUnusedObjects = true, | |
RemovePdfaCompliance = false, | |
Height = 1024 | |
}, | |
OutputPath = "converted/topdf" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "xxxx", | |
AppKey = "xxx-xx" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to Pdf request | |
var request = new ConvertToPdfRequest | |
{ | |
OutPath = "conversions/CellsOptionsPDF", | |
// convert to Pdf settings | |
Request = new PdfConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "three-sheets.xlsx", Password = "" }, | |
// Pdf save options | |
Options = new PdfSaveOptionsDto() { ConvertFileType = GroupDocs.Conversion.Cloud.Sdk.Model.PdfSaveOptionsDto.ConvertFileTypeEnum.Pdf, CellsOptions = new CellsOptionsDto() { ShowGridLines = true, ShowHiddenSheets = false, OnePagePerSheet = false, OptimizePdfSize = true, ConvertRange = "", SkipEmptyRowsAndColumns = true }, PdfOptions = new PdfOptionsDto() } | |
} | |
}; | |
// convert to Pdf | |
var response = apiInstance.ConvertToPdf(request); | |
Debug.Print(response.Href.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi: " + e.Message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "xxxx", | |
AppKey = "xxx-xx" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to Pdf request | |
var request = new ConvertToPdfRequest | |
{ | |
OutPath = "conversions/GrayscalePDF", | |
// convert to Pdf settings | |
Request = new PdfConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample-one-page.docx", Password = "" }, | |
// Pdf save options | |
Options = new PdfSaveOptionsDto() { ConvertFileType = GroupDocs.Conversion.Cloud.Sdk.Model.PdfSaveOptionsDto.ConvertFileTypeEnum.Pdf, PdfOptions = new PdfOptionsDto() { Grayscale = true } } | |
} | |
}; | |
// convert to Pdf | |
var response = apiInstance.ConvertToPdf(request); | |
Debug.Print(response.Href.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "xxxx", | |
AppKey = "xxx-xx" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to Pdf request | |
var request = new ConvertToPdfRequest | |
{ | |
OutPath = "conversions/linearizedPDF", | |
// convert to Pdf settings | |
Request = new PdfConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample-one-page.docx", Password = "" }, | |
// Pdf save options | |
Options = new PdfSaveOptionsDto() { ConvertFileType = GroupDocs.Conversion.Cloud.Sdk.Model.PdfSaveOptionsDto.ConvertFileTypeEnum.Pdf, PdfOptions = new PdfOptionsDto() { Linearize = true } } | |
} | |
}; | |
// convert to Pdf | |
var response = apiInstance.ConvertToPdf(request); | |
Debug.Print(response.Href.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "xxxx", | |
AppKey = "xxx-xx" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to Pdf request | |
var request = new ConvertToPdfRequest | |
{ | |
OutPath = "conversions/ResourceOptimizationPDF", | |
// convert to Pdf settings | |
Request = new PdfConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample-one-page.docx", Password = "" }, | |
// Pdf save options | |
Options = new PdfSaveOptionsDto() { ConvertFileType = GroupDocs.Conversion.Cloud.Sdk.Model.PdfSaveOptionsDto.ConvertFileTypeEnum.Pdf, PdfOptions = new PdfOptionsDto() { OptimizationOptions = new PdfOptimizationOptionsDto() { LinkDuplicateStreams = true, RemoveUnusedObjects = true, RemoveUnusedStreams = true, CompressImages = true, ImageQuality = 60, UnembedFonts = true } } } | |
} | |
}; | |
// convert to Pdf | |
var response = apiInstance.ConvertToPdf(request); | |
Debug.Print(response.Href.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi: " + e.Message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to PDF with load and save options with output as iostream | |
class Convert_To_Pdf_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx", | |
Format = "pdf", | |
LoadOptions = new DocxLoadOptions() { Password = "password" }, | |
ConvertOptions = new PdfConvertOptions() | |
{ | |
BookmarksOutlineLevel = 1, | |
CenterWindow = true, | |
CompressImages = false, | |
DisplayDocTitle = true, | |
Dpi = 1024, | |
ExpandedOutlineLevels = 1, | |
FitWindow = false, | |
FromPage = 1, | |
Grayscale = false, | |
HeadingsOutlineLevels = 1, | |
ImageQuality = 100, | |
Linearize = false, | |
MarginTop = 5, | |
MarginLeft = 5, | |
Password = "password", | |
UnembedFonts = true, | |
RemoveUnusedStreams = true, | |
RemoveUnusedObjects = true, | |
RemovePdfaCompliance = false, | |
Height = 1024 | |
}, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "xxxx", | |
AppKey = "xxx-xx" | |
}; | |
// Initiate api instance | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
// convert to Pdf request | |
var request = new ConvertToPdfRequest | |
{ | |
OutPath = "conversions/WordBookmarksPDF", | |
// convert to Pdf settings | |
Request = new PdfConversionRequest | |
{ | |
// source file to convert | |
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample-one-page.docx", Password = "" }, | |
// Pdf save options | |
Options = new PdfSaveOptionsDto() { ConvertFileType = GroupDocs.Conversion.Cloud.Sdk.Model.PdfSaveOptionsDto.ConvertFileTypeEnum.Pdf, WordBookmarksOptions = new WordBookmarksOptionsDto() { BookmarksOutlineLevel = 4, HeadingsOutlineLevels = 1, ExpandedOutlineLevels = 9 }, PdfOptions = new PdfOptionsDto() } | |
} | |
}; | |
// convert to Pdf | |
var response = apiInstance.ConvertToPdf(request); | |
Debug.Print(response.Href.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Slides with load and save options | |
class Convert_To_Slides | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = "pptx", | |
LoadOptions = new DocxLoadOptions() { Password = "", HideWordTrackedChanges = true, DefaultFont = "Arial" }, | |
ConvertOptions = new PptxConvertOptions() { FromPage = 1, PagesCount = 2, Zoom = 1 }, | |
OutputPath = "converted/toslides" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Slides with load and save options with output as iostream | |
class Convert_To_Slides_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = "pptx", | |
LoadOptions = new DocxLoadOptions() { Password = "", HideWordTrackedChanges = true, DefaultFont = "Arial" }, | |
ConvertOptions = new PptxConvertOptions() { FromPage = 1, PagesCount = 2, Zoom = 1 }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Text with load and save options | |
class Convert_To_Text | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = "txt", | |
LoadOptions = new DocxLoadOptions() { Password = "", HideWordTrackedChanges = true, DefaultFont = "Arial" }, | |
ConvertOptions = new TxtConvertOptions() { FromPage = 1, PagesCount = 2 }, | |
OutputPath = "converted/totext" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Text with load and save options with output as iostream | |
class Convert_To_Text_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.docx", | |
Format = "txt", | |
LoadOptions = new DocxLoadOptions() { Password = "", HideWordTrackedChanges = true, DefaultFont = "Arial" }, | |
ConvertOptions = new TxtConvertOptions() { FromPage = 1, PagesCount = 2 }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Words with load and save options | |
class Convert_To_Words | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.pdf", | |
Format = "docx", | |
LoadOptions = new PdfLoadOptions() { Password = "", HidePdfAnnotations = true, RemoveEmbeddedFiles = false, FlattenAllFields = true }, | |
ConvertOptions = new DocxConvertOptions() { FromPage = 1, PagesCount = 2, Zoom = 100, Dpi = 300 }, | |
OutputPath = "converted/towords" | |
}; | |
// convert to specified format | |
List<StoredConvertedResult> response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response[0].Url); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Convert to Words with load and save options with output as iostream | |
class Convert_To_Words_Stream | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new ConvertApi(configuration); | |
try | |
{ | |
// convert settings | |
var settings = new ConvertSettings | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/sample.pdf", | |
Format = "docx", | |
LoadOptions = new PdfLoadOptions() { Password = "", HidePdfAnnotations = true, RemoveEmbeddedFiles = false, FlattenAllFields = true }, | |
ConvertOptions = new DocxConvertOptions() { FromPage = 1, PagesCount = 2, Zoom = 100, Dpi = 300 }, | |
OutputPath = null // set OutputPath as null will result the output as document IOStream | |
}; | |
// convert to specified format | |
Stream response = apiInstance.ConvertDocumentDownload(new ConvertDocumentRequest(settings)); | |
Console.WriteLine("Document conveted successfully: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling ConvertApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Copy File | |
class Copy_File | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FileApi(configuration); | |
try | |
{ | |
var request = new CopyFileRequest("conversions/one-page1.docx", "conversions/one-page-copied.docx", Common.MyStorage, Common.MyStorage); | |
apiInstance.CopyFile(request); | |
Console.WriteLine("Expected response type is Void: 'conversions/one-page1.docx' file copied as 'conversions/one-page-copied.docx'."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FileApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Copy Folder | |
class Copy_Folder | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FolderApi(configuration); | |
try | |
{ | |
var request = new CopyFolderRequest("conversions", "conversions1", Common.MyStorage, Common.MyStorage); | |
apiInstance.CopyFolder(request); | |
Console.WriteLine("Expected response type is Void: 'conversions' folder copied as 'conversions1'."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FolderApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Create Folder | |
class Create_Folder | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FolderApi(configuration); | |
try | |
{ | |
var request = new CreateFolderRequest("conversions", Common.MyStorage); | |
apiInstance.CreateFolder(request); | |
Console.WriteLine("Expected response type is Void: 'conversions' folder created."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FolderApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Delete File | |
class Delete_File | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FileApi(configuration); | |
try | |
{ | |
var request = new DeleteFileRequest("conversions1/one-page1.docx", Common.MyStorage); | |
apiInstance.DeleteFile(request); | |
Console.WriteLine("Expected response type is Void: 'conversions1/one-page1.docx' deleted."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FileApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Delete Folder | |
class Delete_Folder | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FolderApi(configuration); | |
try | |
{ | |
var request = new DeleteFolderRequest("conversions/conversions1", Common.MyStorage, true); | |
apiInstance.DeleteFolder(request); | |
Console.WriteLine("Expected response type is Void: 'conversions/conversions1' folder deleted recusrsively."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FolderApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Download_File | |
class Download_File | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FileApi(configuration); | |
try | |
{ | |
var request = new DownloadFileRequest("conversions/one-page.docx", Common.MyStorage); | |
var response = apiInstance.DownloadFile(request); | |
Console.WriteLine("Expected response type is Stream: " + response.Length.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FileApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", | |
AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
}; | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
var request = new GetAllPossibleConversionsRequest(); | |
// Get supported file formats | |
var response = apiInstance.GetAllPossibleConversions(request); | |
foreach (var entry in response) | |
{ | |
Debug.Print(string.Format("{0}: {1}", entry.SourceFileType, string.Join(",", entry.PossibleConversions))); | |
} | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi.GetAllPossibleConversions: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", | |
AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
}; | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
var request = new PossibleConversionsForDocumentRequest | |
{ | |
// specify docuent. | |
}; | |
// Get supported file formats for specified document type | |
var response = apiInstance.PossibleConversionsForDocument(request); | |
Debug.Print(string.Format("{0}: {1}", response.SourceFileType, string.Join(",", response.PossibleConversions))); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi.PossibleConversionsForDocument: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
var configuration = new Configuration | |
{ | |
AppSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", | |
AppKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
}; | |
var apiInstance = new ConversionApi(configuration); | |
try | |
{ | |
var request = new GetPossibleConversionsForFileTypeRequest | |
{ | |
Extension = "docx" | |
}; | |
// Get supported file formats for specified file extension | |
var response = apiInstance.GetPossibleConversionsForFileType(request); | |
Debug.Print(string.Format("{0}: {1}", response.SourceFileType, string.Join(",", response.PossibleConversions))); | |
} | |
catch (Exception e) | |
{ | |
Debug.Print("Exception when calling ConversionApi.GetPossibleConversionsForFileType: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get Get Disc Usage | |
class Get_Disc_Usage | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new StorageApi(configuration); | |
try | |
{ | |
var request = new GetDiscUsageRequest(Common.MyStorage); | |
var response = apiInstance.GetDiscUsage(request); | |
Console.WriteLine("Expected response type is DiscUsage: " + response.UsedSize.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling StorageApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get Document Information / Docuement Metada | |
class Get_Document_Information | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new InfoApi(configuration); | |
try | |
{ | |
// get document info/metadata request | |
var request = new GetDocumentMetadataRequest | |
{ | |
StorageName = Common.MyStorage, | |
FilePath = "conversions/password-protected.docx" | |
}; | |
// Execute api method to get response. | |
var response = apiInstance.GetDocumentMetadata(request); | |
Console.WriteLine("Expected response type is DocumentMetadata: " + response.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception when calling InfoApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get File Versions | |
class Get_File_Versions | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new StorageApi(configuration); | |
try | |
{ | |
var request = new GetFileVersionsRequest("conversions/one-page.docx", Common.MyStorage); | |
var response = apiInstance.GetFileVersions(request); | |
Console.WriteLine("Expected response type is FileVersions: " + response.Value.Count.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling StorageApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get Files List | |
class Get_Files_List | |
{ | |
public static void Run(string path) | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FolderApi(configuration); | |
try | |
{ | |
var request = new GetFilesListRequest(path, Common.MyStorage); | |
var response = apiInstance.GetFilesList(request); | |
foreach (StorageFile storageFile in response.Value) | |
{ | |
Console.WriteLine("Expected response type is FilesList: " + storageFile.Path); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FolderApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get All Supported Formats | |
class Get_All_Supported_Formats | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new InfoApi(configuration); | |
try | |
{ | |
// Get supported file formats | |
var response = apiInstance.GetSupportedConversionTypes(new GetSupportedConversionTypesRequest()); | |
foreach (var entry in response) | |
{ | |
foreach (var formats in entry.TargetFormats) | |
{ | |
Console.WriteLine(string.Format("{0} TO {1}", entry.SourceFormat, string.Join(",", formats))); | |
} | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling InfoApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get All Supported Formats For Provided Document | |
class Get_All_Possible_Conversions_For_Document | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new InfoApi(configuration); | |
try | |
{ | |
// Get supported file formats | |
var response = apiInstance.GetSupportedConversionTypes(new GetSupportedConversionTypesRequest("conversions/sample.docx", Common.MyStorage)); | |
foreach (var entry in response) | |
{ | |
foreach (var formats in entry.TargetFormats) | |
{ | |
Console.WriteLine(string.Format("{0} TO {1}", entry.SourceFormat, string.Join(",", formats))); | |
} | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling InfoApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Get All Supported Formats For Provided Extension | |
class Get_All_Possible_Conversions_For_Extension | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new InfoApi(configuration); | |
try | |
{ | |
// Get supported file formats | |
var response = apiInstance.GetSupportedConversionTypes(new GetSupportedConversionTypesRequest(null, null, "xlsx")); | |
foreach (var entry in response) | |
{ | |
foreach (var formats in entry.TargetFormats) | |
{ | |
Console.WriteLine(string.Format("{0} TO {1}", entry.SourceFormat, string.Join(",", formats))); | |
} | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling InfoApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Cad/Sample.dwg", | |
Format = "pdf", | |
LoadOptions = new CadLoadOptions | |
{ | |
Width = 1920, | |
Height = 1080 | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Spreadsheet/sample.csv", | |
Format = "pdf", | |
LoadOptions = new CsvLoadOptions | |
{ | |
Separator = "," | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Email/sample.msg", | |
Format = "pdf", | |
LoadOptions = new EmailLoadOptions | |
{ | |
DisplayHeader = false, | |
DisplayFromEmailAddress = false, | |
DisplayToEmailAddress = false, | |
DisplayEmailAddress = false, | |
DisplayCcEmailAddress = false, | |
DisplayBccEmailAddress = false | |
}, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new OneLoadOptions | |
{ | |
FontSubstitutes = new Dictionary<string, string> | |
{ | |
{"Tahoma", "Arial"}, {"Times New Roman", "Arial"} | |
} | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Note/sample.one", | |
Format = "pdf", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new PdfLoadOptions | |
{ | |
HidePdfAnnotations = true | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Pdf/sample.pdf", | |
Format = "docx", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new PresentationLoadOptions | |
{ | |
HideComments = true | |
}; | |
var settings = new ConvertSettings | |
{ | |
StorageName = Constants.MyStorage, | |
FilePath = "Presentation/with_notes.pptx", | |
Format = "pdf", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new SpreadsheetLoadOptions | |
{ | |
HideComments = true, | |
OnePagePerSheet = true, | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Spreadsheet/sample.xlsx", | |
Format = "pdf", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new TxtLoadOptions | |
{ | |
Encoding = "shift_jis" | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "Text/sample.txt", | |
Format = "pdf", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples | |
string MyAppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
string MyAppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud | |
var configuration = new Configuration(MyAppSid, MyAppKey); | |
// Create necessary API instances | |
var apiInstance = new ConvertApi(configuration); | |
// Prepare convert settings | |
var loadOptions = new WordProcessingLoadOptions | |
{ | |
HideComments = true | |
}; | |
var settings = new ConvertSettings | |
{ | |
FilePath = "WordProcessing/with_tracked_changes.docx", | |
Format = "pdf", | |
LoadOptions = loadOptions, | |
OutputPath = "converted" | |
}; | |
// Convert to specified format | |
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Move File | |
class Move_File | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FileApi(configuration); | |
try | |
{ | |
var request = new MoveFileRequest("conversions/one-page1.docx", "conversions1/one-page1.docx", Common.MyStorage, Common.MyStorage); | |
apiInstance.MoveFile(request); | |
Console.WriteLine("Expected response type is Void: 'conversions/one-page1.docx' file moved to 'conversions1/one-page1.docx'."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FileApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Move Folder | |
class Move_Folder | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FolderApi(configuration); | |
try | |
{ | |
var request = new MoveFolderRequest("conversions1", "conversions/conversions1", Common.MyStorage, Common.MyStorage); | |
apiInstance.MoveFolder(request); | |
Console.WriteLine("Expected response type is Void: 'conversions1' folder moved to 'conversions/conversions1'."); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FolderApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Is Object Exists | |
class Object_Exists | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new StorageApi(configuration); | |
try | |
{ | |
var request = new ObjectExistsRequest("conversions/one-page.docx", Common.MyStorage); | |
var response = apiInstance.ObjectExists(request); | |
Console.WriteLine("Expected response type is ObjectExist: " + response.Exists.Value.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling StorageApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using GroupDocs.Conversion.Cloud.Sdk.Model; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
class RunExamples | |
{ | |
static void Main(string[] args) | |
{ | |
//// *********************************************************** | |
//// GroupDocs.Conversion Cloud API Examples | |
//// *********************************************************** | |
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required). | |
Common.MyAppSid = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"; | |
Common.MyAppKey = "XXXXXXXXXXXXXXX"; | |
Common.MyStorage = "XXXXX"; | |
// Uploading sample test files from local to storage under folder 'conversions' | |
//Common.UploadSampleTestFiles(); | |
//// *********************************************************** | |
///// ***** WORKING WITH STORAGE ***** | |
//// *********************************************************** | |
// Is Storage Exist | |
//Storage_Exist.Run(); | |
// Get Get Disc Usage | |
//Get_Disc_Usage.Run(); | |
// Get File Versions | |
//Get_File_Versions.Run(); | |
// Is Object Exists | |
//Object_Exists.Run(); | |
//// *********************************************************** | |
//// ***** WORKING WITH FOLDER ***** | |
//// *********************************************************** | |
// Create Folder | |
//Create_Folder.Run(); | |
// Copy Folder | |
//Copy_Folder.Run(); | |
// Move Folder | |
//Move_Folder.Run(); | |
// Delete Folder | |
//Delete_Folder.Run(); | |
// Get Files List | |
//Get_Files_List.Run("converted"); | |
//// *********************************************************** | |
//// ***** WORKING WITH FILES ***** | |
//// *********************************************************** | |
// Upload File | |
//Upload_File.Run(); | |
// Copy File | |
//Copy_File.Run(); | |
// Move File | |
//Move_File.Run(); | |
// Delete File | |
//Delete_File.Run(); | |
// Download_File | |
//Download_File.Run(); | |
//// *********************************************************** | |
//// ***** WORKING WITH SUPPORTED FORMATS ***** | |
//// *********************************************************** | |
// Get All Supported Formats | |
Get_All_Supported_Formats.Run(); | |
// Get All Supported Formats For Provided Document | |
//Get_All_Possible_Conversions_For_Document.Run(); | |
// Get All Supported Formats For Provided Extension | |
//Get_All_Possible_Conversions_For_Extension.Run(); | |
//// *********************************************************** | |
//// ***** WORKING WITH DOCUMENT INFORMATION ***** | |
//// *********************************************************** | |
// Get Document Information / Docuement Metada | |
//Get_Document_Information.Run(); | |
//// *********************************************************** | |
//// ***** WORKING WITH CONVERSIONS ***** | |
//// *********************************************************** | |
// Quick Convert to Any Desired Output Format | |
Convert_To_Any_Format.Run("jpg", new JpgConvertOptions()); | |
// Quick Convert to Any Desired Output Format with output as iostream | |
Convert_To_Any_Format_Stream.Run("jpg", new JpgConvertOptions()); | |
// Convert to Cells with load and save options | |
//Convert_To_Cells.Run(); | |
// Convert to Cells with load and save options with output as iostream | |
//Convert_To_Cells_Stream.Run(); | |
// Convert to Html with load and save options | |
//Convert_To_Html.Run(); | |
// Convert to Html with load and save options with output as iostream | |
//Convert_To_Html_Stream.Run(); | |
// Convert to image/s with load and save options | |
//Convert_To_Images.Run(); | |
// Convert to Images with load and save options with output as iostream | |
//Convert_To_Images_Stream.Run(); | |
// Convert to PDF with load and save options | |
//Convert_To_Pdf.Run(); | |
// Convert to PDF with load and save options with output as iostream | |
//Convert_To_Pdf_Stream.Run(); | |
// Convert to Slides with load and save options | |
//Convert_To_Slides.Run(); | |
// Convert to Slides with load and save options with output as iostream | |
//Convert_To_Slides_Stream.Run(); | |
// Convert to Words with load and save options | |
//Convert_To_Words.Run(); | |
// Convert to Words with load and save options with output as iostream | |
//Convert_To_Words_Stream.Run(); | |
// Convert to Text with load and save options | |
//Convert_To_Text.Run(); | |
// Convert to Text with load and save options with output as iostream | |
//Convert_To_Text_Stream.Run(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Is Storage Exist | |
class Storage_Exist | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new StorageApi(configuration); | |
try | |
{ | |
var request = new StorageExistsRequest(Common.MyStorage); | |
var response = apiInstance.StorageExists(request); | |
Console.WriteLine("Expected response type is StorageExist: " + response.Exists.Value.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling StorageApi: " + e.Message); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GroupDocs.Conversion.Cloud.Sdk.Api; | |
using GroupDocs.Conversion.Cloud.Sdk.Client; | |
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests; | |
using System; | |
using System.IO; | |
namespace GroupDocs.Conversion.Cloud.Examples.CSharp | |
{ | |
// Upload File | |
class Upload_File | |
{ | |
public static void Run() | |
{ | |
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); | |
var apiInstance = new FileApi(configuration); | |
try | |
{ | |
// Open file in IOStream from local/disc. | |
var fileStream = File.Open("..\\..\\..\\Data\\conversions\\one-page.docx", FileMode.Open); | |
var request = new UploadFileRequest("conversions/one-page1.docx", fileStream, Common.MyStorage); | |
var response = apiInstance.UploadFile(request); | |
Console.WriteLine("Expected response type is FilesUploadResult: " + response.Uploaded.Count.ToString()); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Exception while calling FileApi: " + e.Message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment