Skip to content

Commit 324ac11

Browse files
committed
Updated sources
1 parent 3c8f806 commit 324ac11

8 files changed

Lines changed: 491 additions & 176 deletions

File tree

README.md

Lines changed: 26 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,48 @@
11
# GroupDocs.Conversion Cloud SDK for .NET
22

3-
This repository contains GroupDocs.Conversion Cloud SDK for .NET source code. This SDK has been developed to help you get started with using our document conversion REST API, allowing to seamlessly convert your documents to any format you need. With this single API, you can convert back and forth between over 50 types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, HTML, CAD, raster images and many more.
3+
This repository contains GroupDocs.Conversion Cloud SDK for .NET source code. This SDK allows you to work with GroupDocs.Conversion Cloud REST APIs in your .NET applications.
44

55
## How to use the SDK
66

77
The complete source code is available in this repository folder, you can either directly use it in your project via NuGet package manager. For more details, please visit our [documentation website](https://docs.groupdocs.cloud/display/conversioncloud/Available+SDKs#AvailableSDKs-.NET).
88

9-
### Create an account
10-
Creating an account is very simple. Go to Dashboard to create a free account.
11-
We’re using Single Sign On across our websites, therefore, if you already have an account with our services, you can use it to also access the [Dashboard](https://dashboard.groupdocs.cloud).
9+
## Dependencies
1210

13-
### Create an API client app
14-
Before you can make any requests to GroupDocs Cloud API you need to get a Client Id and a Client Secret. This will be used to invoke GroupDocs Cloud API. You can get it by creating a new [Application](https://dashboard.groupdocs.cloud/applications).
11+
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json)
1512

16-
## Convert document
13+
## Getting Started
1714

1815
```csharp
16+
using System;
17+
using System.Diagnostics;
1918
using GroupDocs.Conversion.Cloud.Sdk.Api;
20-
using GroupDocs.Conversion.Cloud.Sdk.Client;
21-
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
2219

23-
namespace ConversionCloudExample
20+
namespace Example
2421
{
25-
internal class Program
22+
public class Example
2623
{
27-
static void Main(string[] args)
24+
public void Main()
2825
{
29-
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples
30-
string MyClientSecret = ""; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
31-
string MyClientId = ""; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
26+
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
27+
var appSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
28+
var appKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
3229

33-
var configuration = new Configuration(MyClientId, MyClientSecret);
30+
var api = new InfoApi(appSid, appKey);
3431

35-
// Create necessary API instances
36-
var apiInstance = new ConvertApi(configuration);
37-
38-
// Prepare request
39-
var fileStream = File.Open("myFile.docx", FileMode.Open);
40-
var request = new ConvertDocumentDirectRequest("pdf", fileStream);
41-
42-
// Convert to specified format
43-
var response = apiInstance.ConvertDocumentDirect(request);
44-
Console.WriteLine("Document converted successfully: " + response.Length);
45-
}
46-
}
47-
}
48-
49-
```
50-
51-
## Convert document using cloud storage
52-
53-
```csharp
54-
using GroupDocs.Conversion.Cloud.Sdk.Api;
55-
using GroupDocs.Conversion.Cloud.Sdk.Client;
56-
using GroupDocs.Conversion.Cloud.Sdk.Model;
57-
using GroupDocs.Conversion.Cloud.Sdk.Model.Requests;
58-
59-
namespace ConversionCloudExample
60-
{
61-
internal class Program
62-
{
63-
static void Main(string[] args)
64-
{
65-
// For complete examples and data files, please go to https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples
66-
string MyClientSecret = ""; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
67-
string MyClientId = ""; // Get ClientId and ClientSecret from https://dashboard.groupdocs.cloud
68-
69-
var configuration = new Configuration(MyClientId, MyClientSecret);
70-
71-
// Create necessary API instances
72-
var fileApi = new FileApi(configuration);
73-
var convertApi = new ConvertApi(configuration);
74-
75-
// Upload file to cloud storage
76-
var fileStream = File.Open("myFile.docx", FileMode.Open);
77-
fileApi.UploadFile(new UploadFileRequest("myFile.docx", fileStream));
78-
79-
// Prepare convert settings
80-
var settings = new ConvertSettings
32+
try
8133
{
82-
FilePath = "myFile.docx",
83-
Format = "pdf",
84-
OutputPath = "converted"
85-
};
86-
87-
// Convert to specified format
88-
convertApi.ConvertDocument(new ConvertDocumentRequest(settings));
89-
90-
// Download the result
91-
92-
var response = fileApi.DownloadFile(new DownloadFileRequest("converted/myFile.pdf"));
93-
Console.WriteLine("Expected response type is Stream: " + response.Length.ToString());
34+
// Get supported file formats
35+
var formats = api.GetSupportedConversionTypes(new GetSupportedConversionTypesRequest());
36+
37+
foreach (var format in formats)
38+
{
39+
Debug.Print(format.SourceFormat);
40+
}
41+
}
42+
catch (Exception e)
43+
{
44+
Debug.Print("Something went wrong: " + e.Message);
45+
}
9446
}
9547
}
9648
}

src/GroupDocs.Conversion.Cloud.Sdk/GroupDocs.Conversion.Cloud.Sdk.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net20</TargetFrameworks>
5-
<AssemblyVersion>25.6.0.0</AssemblyVersion>
6-
<FileVersion>25.6.0.0</FileVersion>
7-
<Version>25.6</Version>
5+
<AssemblyVersion>25.8.0.0</AssemblyVersion>
6+
<FileVersion>25.8.0.0</FileVersion>
7+
<Version>25.8</Version>
88
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
99
<Company>GroupDocs</Company>
1010
<Authors>GroupDocs Product Team</Authors>

0 commit comments

Comments
 (0)