Skip to content

Commit aa74937

Browse files
Added SDK Examples
1 parent f449984 commit aa74937

31 files changed

Lines changed: 3061 additions & 53 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace GroupDocs.Conversion.Cloud.Examples
8+
{
9+
class Common
10+
{
11+
public static string MyAppSid = Common.MyAppSid;
12+
public static string MyAppKey = Common.MyAppKey;
13+
}
14+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
12+
{
13+
// Quick Convert to Any Desired Output Format and Get Output File Url
14+
class Convert_To_Any_Format
15+
{
16+
public static void Run()
17+
{
18+
var configuration = new Configuration
19+
{
20+
AppSid = Common.MyAppSid,
21+
AppKey = Common.MyAppKey
22+
};
23+
24+
// Initiate api instance
25+
var apiInstance = new ConversionApi(configuration);
26+
27+
try
28+
{
29+
// convert to any format (quick convert) request
30+
var request = new QuickConvertRequest
31+
{
32+
// convert to cells Request
33+
Request = new QuickConversionRequest
34+
{
35+
// source file to convert
36+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" },
37+
// quick convert format
38+
Format = "pdf"
39+
}
40+
};
41+
42+
// convert to specified format
43+
var response = apiInstance.QuickConvert(request);
44+
Console.Write(response.Href.ToString());
45+
}
46+
catch (Exception e)
47+
{
48+
Console.Write("Exception when calling ConversionApi.QuickConvert: " + e.Message);
49+
}
50+
}
51+
}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
12+
{
13+
// Quick Convert to Any Desired Output Format and Get Output File Stream
14+
class Convert_To_Any_Format_Stream
15+
{
16+
public static void Run()
17+
{
18+
var configuration = new Configuration
19+
{
20+
AppSid = Common.MyAppSid,
21+
AppKey = Common.MyAppKey
22+
};
23+
24+
// Initiate api instance
25+
var apiInstance = new ConversionApi(configuration);
26+
27+
try
28+
{
29+
// convert to any format (quick convert) request
30+
var request = new QuickConvertToStreamRequest
31+
{
32+
// convert to cells request
33+
Request = new QuickConversionRequest
34+
{
35+
// source file to convert
36+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.pdf", Password = "" },
37+
// quick convert format
38+
Format = "doc"
39+
}
40+
};
41+
42+
// convert to specified format
43+
var response = apiInstance.QuickConvertToStream(request);
44+
Console.Write(response.Length.ToString());
45+
}
46+
catch (Exception e)
47+
{
48+
Console.Write("Exception when calling ConversionApi.QuickConvertToStream: " + e.Message);
49+
}
50+
}
51+
}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
12+
{
13+
// Convert to Cells and Get Output File Url
14+
class Convert_To_Cells
15+
{
16+
public static void Run()
17+
{
18+
var configuration = new Configuration
19+
{
20+
AppSid = Common.MyAppSid,
21+
AppKey = Common.MyAppKey
22+
};
23+
24+
// Initiate api instance
25+
var apiInstance = new ConversionApi(configuration);
26+
27+
try
28+
{
29+
// convert to cells request
30+
var request = new ConvertToCellsRequest
31+
{
32+
// convert to cells Request
33+
Request = new CellsConversionRequest
34+
{
35+
// source file to convert
36+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" },
37+
// cells save options
38+
Options = new CellsSaveOptionsDto()
39+
}
40+
};
41+
42+
// convert to cells
43+
var response = apiInstance.ConvertToCells(request);
44+
Console.Write(response.Href.ToString());
45+
}
46+
catch (Exception e)
47+
{
48+
Console.Write("Exception when calling ConversionApi.ConvertToCells: " + e.Message);
49+
}
50+
}
51+
}
52+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.IO;
8+
using System.Linq;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
12+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
13+
{
14+
// Convert to Cells and Get Output File Stream
15+
class Convert_To_Cells_Stream
16+
{
17+
public static Stream Run()
18+
{
19+
var configuration = new Configuration
20+
{
21+
AppSid = Common.MyAppSid,
22+
AppKey = Common.MyAppKey
23+
};
24+
25+
// Initiate api instance
26+
var apiInstance = new ConversionApi(configuration);
27+
28+
try
29+
{
30+
// convert to cells request
31+
var request = new ConvertToCellsStreamRequest
32+
{
33+
// convert to cells Request
34+
Request = new CellsConversionRequest
35+
{
36+
// source file to convert
37+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" },
38+
// cells save options
39+
Options = new CellsSaveOptionsDto()
40+
}
41+
};
42+
43+
// convert to cells
44+
var response = apiInstance.ConvertToCellsStream(request);
45+
Console.Write(response.Length.ToString());
46+
return response;
47+
}
48+
catch (Exception e)
49+
{
50+
Console.Write("Exception when calling ConversionApi.ConvertToCellsStream: " + e.Message);
51+
}
52+
return null;
53+
}
54+
}
55+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
12+
{
13+
// Convert to Html and Get Output File Url
14+
class Convert_To_Html
15+
{
16+
public static void Run()
17+
{
18+
var configuration = new Configuration
19+
{
20+
AppSid = Common.MyAppSid,
21+
AppKey = Common.MyAppKey
22+
};
23+
24+
// Initiate api instance
25+
var apiInstance = new ConversionApi(configuration);
26+
27+
try
28+
{
29+
// convert to HTML request
30+
var request = new ConvertToHtmlRequest
31+
{
32+
// convert to HTML Request
33+
Request = new HtmlConversionRequest
34+
{
35+
// source file to convert
36+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" },
37+
// HTML save options
38+
Options = new HtmlSaveOptionsDto()
39+
}
40+
};
41+
42+
// convert to HTML
43+
var response = apiInstance.ConvertToHtml(request);
44+
Console.Write(response.Href.ToString());
45+
}
46+
catch (Exception e)
47+
{
48+
Console.Write("Exception when calling ConversionApi.ConvertToHtml: " + e.Message);
49+
}
50+
}
51+
}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using GroupDocs.Conversion.Cloud.Sdk;
2+
using GroupDocs.Conversion.Cloud.Sdk.Api;
3+
using GroupDocs.Conversion.Cloud.Sdk.Model;
4+
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
5+
using System;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
11+
namespace GroupDocs.Conversion.Cloud.Examples.Conversions
12+
{
13+
// Convert to Html and Get Output File Stream
14+
class Convert_To_Html_Stream
15+
{
16+
public static void Run()
17+
{
18+
var configuration = new Configuration
19+
{
20+
AppSid = Common.MyAppSid,
21+
AppKey = Common.MyAppKey
22+
};
23+
24+
// Initiate api instance
25+
var apiInstance = new ConversionApi(configuration);
26+
27+
try
28+
{
29+
// convert to HTML request
30+
var request = new ConvertToHtmlStreamRequest
31+
{
32+
// convert to HTML Request
33+
Request = new HtmlConversionRequest
34+
{
35+
// source file to convert
36+
SourceFile = new ConversionFileInfo() { Folder = "conversions", Name = "sample.docx", Password = "" },
37+
// HTML save options
38+
Options = new HtmlSaveOptionsDto()
39+
}
40+
};
41+
42+
// convert to HTML
43+
var response = apiInstance.ConvertToHtmlStream(request);
44+
Console.Write(response.Length.ToString());
45+
}
46+
catch (Exception e)
47+
{
48+
Console.Write("Exception when calling ConversionApi.ConvertToHtmlStream: " + e.Message);
49+
}
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)