Skip to content

Instantly share code, notes, and snippets.

@groupdocscloud
Last active October 23, 2019 11:42
Show Gist options
  • Save groupdocscloud/9cff9e42173d5964e88b2ee989ce4a83 to your computer and use it in GitHub Desktop.
Save groupdocscloud/9cff9e42173d5964e88b2ee989ce4a83 to your computer and use it in GitHub Desktop.
Annotation-CSharp-v2
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add annotations
class Add_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest()
{
filePath = "Annotationdocs\\ten-pages.docx",
annotations = new System.Collections.Generic.List<AnnotationInfo>() {
new AnnotationInfo
{
AnnotationPosition = new Point { X = 852, Y = 59.388262910798119 },
Box = new Rectangle { X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 },
PageNumber = 0,
PenColor = 1201033,
PenStyle = 0,
PenWidth = 1,
Type = AnnotationInfo.TypeEnum.Area,
CreatorName = "Anonym A."
}
}
};
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Area annotations
class Add_Area_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
BackgroundColor = 65535,
PenColor = 65535,
PenStyle = 1,
PenWidth = 3,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Area,
Text = "This is area annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Area Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Arrow annotations
class Add_Arrow_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
BackgroundColor = 65535,
PenColor = 65535,
PenStyle = 1,
PenWidth = 3,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Arrow,
Text = "This is arrow annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Arrow Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Distance annotations
class Add_Distance_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
BackgroundColor = 65535,
PenColor = 65535,
PenStyle = 1,
PenWidth = 3,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Distance,
Text = "This is distance annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Distance Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add multiple annotations
class Add_Multiple_Annotations
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations = {
new AnnotationInfo
{
AnnotationPosition = new Point { X = 852, Y = 59.388262910798119 },
Box = new Rectangle { X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 },
PageNumber = 0,
PenColor = 1201033,
PenStyle = 0,
PenWidth = 1,
Type = AnnotationInfo.TypeEnum.Distance,
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now
},
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
BackgroundColor=65535,
PenColor = 65535,
PenStyle = 1,
PenWidth = 3,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Area,
Text="This is area annotation",
CreatorName = "Anonym A.",
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
} },
new AnnotationInfo
{
AnnotationPosition = new Point { X = 852, Y = 59.388262910798119 },
Box = new Rectangle { X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 },
PageNumber = 2,
PenColor = 1201033,
PenStyle = 0,
PenWidth = 1,
Type = AnnotationInfo.TypeEnum.Area,
CreatorName = "Anonym A."
},
new AnnotationInfo
{
AnnotationPosition = new Point { X = 852, Y = 59.388262910798119 },
Box = new Rectangle { X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 },
PageNumber = 4,
Type = AnnotationInfo.TypeEnum.Point,
CreatorName = "Anonym A."
},
new AnnotationInfo
{
AnnotationPosition = new Point { X = 852, Y = 59.388262910798119 },
Box = new Rectangle { X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 },
PageNumber = 5,
PenColor = 1201033,
PenStyle = 0,
PenWidth = 1,
Type = AnnotationInfo.TypeEnum.Arrow,
CreatorName = "Anonym A."
}
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Multiple Annotations added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Point annotations
class Add_Point_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
Type = AnnotationInfo.TypeEnum.Point,
Text = "This is point annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Point Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Polyline annotations
class Add_Polyline_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
PenColor = 65535,
PenStyle = 1,
PenWidth = 3,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Polyline,
Text = "This is polyline annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Polyline Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text annotations
class Add_Text_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
FontColor = 65535,
FontSize = 12,
PageNumber = 1,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Text,
Text = "This is text annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text Field annotations
class Add_TextField_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
FontColor = 65535,
FontSize = 12,
PageNumber = 1,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.TextField,
Text = "This is text field annotation",
FieldText = "Text field text",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Field Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text Redaction annotations
class Add_TextRedaction_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
Type = AnnotationInfo.TypeEnum.TextRedaction,
Text = "This is text redaction annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Redatction Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text Replacement annotations
class Add_TextReplacement_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
PageNumber = 1,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.TextReplacement,
FieldText = "Text to replace",
Text = "This is text replacement annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Replacement Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text Strikeout annotations
class Add_TextStrikeout_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
FontColor = 65535,
PageNumber = 1,
Type = AnnotationInfo.TypeEnum.TextStrikeout,
Text = "This is text strikeout annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Strikeout Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Text Underline annotations
class Add_TextUnderline_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
FontColor = 65535,
PageNumber = 1,
Type = AnnotationInfo.TypeEnum.TextUnderline,
Text = "This is text underline annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Text Underline Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Post/Add Watermark annotations
class Add_Watermark_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new PostAnnotationsRequest();
request.filePath = "Annotationdocs\\ten-pages.pdf";
AnnotationInfo[] annotations =
{
new AnnotationInfo
{
AnnotationPosition = new Point { X = 1, Y = 1 },
Box = new Rectangle { X = 100, Y = 100, Width = 100, Height = 100 },
FontColor = 65535,
FontSize = 12,
Angle = 75,
PageNumber = 1,
Opacity = 0.7,
Type = AnnotationInfo.TypeEnum.Watermark,
Text = "This is watermark annotation",
CreatorName = "Anonym A.",
CreatedOn = DateTime.Now,
Replies = new List<AnnotationReplyInfo>
{
new AnnotationReplyInfo
{
Message = "First comment",
RepliedOn = DateTime.Now
},
new AnnotationReplyInfo
{
Message = "Second comment",
RepliedOn = DateTime.Now
}
}
},
};
request.annotations = annotations.ToList();
apiInstance.PostAnnotations(request);
Console.WriteLine("Expected response type is void: Watermark Annotation added.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System.IO;
using System;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Api;
namespace GroupDocs.Annotation.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.");
}
}
}
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
using System;
namespace GroupDocs.Annotation.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("Annotationdocs/one-page1.docx", "Annotationdocs/one-page-copied.docx", Common.MyStorage, Common.MyStorage);
apiInstance.CopyFile(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs/one-page1.docx' file copied as 'Annotationdocs/one-page-copied.docx'.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FileApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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("Annotationdocs", "Annotationdocs1", Common.MyStorage, Common.MyStorage);
apiInstance.CopyFolder(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs' folder copied as 'Annotationdocs1'.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FolderApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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("", Common.MyStorage);
apiInstance.CreateFolder(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs' folder created.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FolderApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Delete annotation from document
class Delete_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new DeleteAnnotationsRequest()
{
filePath = "Annotationdocs\\one-page.docx"
};
apiInstance.DeleteAnnotations(request);
Console.WriteLine("Expected response type is Void: Annotation deleted from document.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
using System;
namespace GroupDocs.Annotation.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("Annotationdocs1/one-page1.docx", Common.MyStorage);
apiInstance.DeleteFile(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs1/one-page1.docx' deleted.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FileApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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("Annotationdocs/Annotationdocs1", Common.MyStorage, true);
apiInstance.DeleteFolder(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs/Annotationdocs1' folder deleted recusrsively.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FolderApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Delete document pages created as images from File
class Delete_Pages
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new PreviewApi(configuration);
try
{
// Set request.
var request = new DeletePagesRequest()
{
filePath = "Annotationdocs\\one-page.docx"
};
apiInstance.DeletePages(request);
Console.WriteLine("Expected response type is Void: pages deleted.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation PreviewApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get document information from File
class DocumentInfo_File
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new InfoApi(configuration);
try
{
// Set request.
var request = new GetInfoRequest()
{
filePath = "Annotationdocs\\one-page.docx",
password = null
};
var response = apiInstance.GetInfo(request);
Console.WriteLine("Expected response type is InfoResult: " + response.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation InfoApi: " + e.Message);
}
}
}
}
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
using System;
using System.IO;
namespace GroupDocs.Annotation.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("Annotationdocs/ten-pages.pdf", Common.MyStorage);
Stream response = apiInstance.DownloadFile(request);
using (var fileStream = File.Create("D:\\tenpages.pdf"))
{
response.Seek(0, SeekOrigin.Begin);
response.CopyTo(fileStream);
}
Console.WriteLine("Expected response type is Stream: " + response.Length.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FileApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get document annotation from File
class Get_Annotation
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new GetImportRequest()
{
filePath = "Annotationdocs\\ten-pages.docx"
};
var response = apiInstance.GetImport(request);
Console.WriteLine("Expected response type is List<AnnotationInfo>: " + response.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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);
}
}
}
}
using System;
using System.IO;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get document with annotation result as Stream
class Get_Export_Document
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new GetExportRequest()
{
filePath = "Annotationdocs\\ten-pages.pdf",
password = null,
annotatedPages = true,
annotationTypes = null,
firstPage = 1,
lastPage = 2
};
Stream response = apiInstance.GetExport(request);
Console.WriteLine("Expected response type is Stream: Document Length: " + response.Length.ToString());
using (var fileStream = File.Create("D:\\Results-ten-pages.pdf"))
{
response.Seek(0, SeekOrigin.Begin);
response.CopyTo(fileStream);
}
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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("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);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get Files List
class Get_Files_List
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new FolderApi(configuration);
try
{
var request = new GetFilesListRequest("Annotationdocs", Common.MyStorage);
var response = apiInstance.GetFilesList(request);
Console.WriteLine("Expected response type is FilesList: " + response.Value.Count.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FolderApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get document pages as images from File
class Get_Pages
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new PreviewApi(configuration);
try
{
// Set request.
var request = new GetPagesRequest()
{
filePath = "Annotationdocs\\ten-pages.docx",
password = null,
pageNumber = 1,
countPagesToConvert = 1,
enableCaching = false,
cacheStoragePath = null,
withoutAnnotations = true
};
var response = apiInstance.GetPages(request);
Console.WriteLine("Expected response type is PageImages: " + response.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation PreviewApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
// Get document as PDF with annotation result as Stream
class Get_PDF
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new AnnotateApi(configuration);
try
{
// Set request.
var request = new GetPdfRequest()
{
filePath = "Annotationdocs\\ten-pages.docx"
};
var response = apiInstance.GetPdf(request);
Console.WriteLine("Expected response type is Stream: Document Length: " + response.Length.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation AnnotateApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
namespace GroupDocs.Annotation.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.GetSupportedFileFormats();
foreach (var entry in response.Formats)
{
Console.WriteLine(string.Format("{0}: {1}", entry.FileFormat, string.Join(",", entry.Extension)));
}
}
catch (Exception e)
{
Console.WriteLine("Exception while calling Annotation InfoApi: " + e.Message);
}
}
}
}
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
using System;
namespace GroupDocs.Annotation.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("Annotationdocs/one-page1.docx", "Annotationdocs1/one-page1.docx", Common.MyStorage, Common.MyStorage);
apiInstance.MoveFile(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs/one-page1.docx' file moved to 'Annotationdocs1/one-page1.docx'.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FileApi: " + e.Message);
}
}
}
}
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
using System;
namespace GroupDocs.Annotation.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("Annotationdocs1", "Annotationdocs\\Annotationdocs1", Common.MyStorage, Common.MyStorage);
apiInstance.MoveFolder(request);
Console.WriteLine("Expected response type is Void: 'Annotationdocs1' folder moved to 'Annotationdocs/Annotationdocs1'.");
}
catch (Exception e)
{
Console.WriteLine("Exception while calling FolderApi: " + e.Message);
}
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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("Annotationdocs/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);
}
}
}
}
using System;
namespace GroupDocs.Annotation.Cloud.Examples.CSharp
{
class RunExamples
{
static void Main(string[] args)
{
//// ***********************************************************
//// GroupDocs.Annotation 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 = "XXXXXXXXXXXXXXXXXXXX";
Common.MyStorage = "XXXXXXXXXX";
//// Uploading sample test files from local to storage under folder 'Annotationdocs'
//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();
//// ***********************************************************
//// ***** 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();
//// ***********************************************************
//// ***** WORKING WITH SUPPORTED BARCODES *****
//// ***********************************************************
//// Get All Supported Barcodes
//Get_All_Supported_Barcodes.Run();
//// ***********************************************************
/////// ***** WORKING WITH DOCUMENT INFORMATION *****
//// ***********************************************************
//// Get document information from File
//DocumentInfo_File.Run();
//// ***********************************************************
/////// ***** WORKING WITH DOCUMENT PAGES *****
//// ***********************************************************
//// Get document pages as images from File
//Get_Pages.Run();
//// Delete document pages created as images from File
//Delete_Pages.Run();
//// ***********************************************************
/////// ***** WORKING WITH ANNOTATIONS *****
//// ***********************************************************
//// ***********************************************************
/////// ***** ADD ANNOTATIONS *****
//// ***********************************************************
//// Post/Add Area annotations
//Add_Area_Annotation.Run();
//// Post/Add Arrow annotations
//Add_Arrow_Annotation.Run();
//// Post/Add Distance annotations
//Add_Distance_Annotation.Run();
//// Post/Add Point annotations
//Add_Point_Annotation.Run();
//// Post/Add Polyline annotations
//Add_Polyline_Annotation.Run();
//// Post/Add Text annotations
//Add_Text_Annotation.Run();
//// Post/Add Text Field annotations
//Add_TextField_Annotation.Run();
//// Post/Add Text Replacement annotations
//Add_TextReplacement_Annotation.Run();
//// Post/Add Text Redaction annotations
//Add_TextRedaction_Annotation.Run();
//// Post/Add Text Strikeout annotations
//Add_TextStrikeout_Annotation.Run();
//// Post/Add Text Underline annotations
//Add_TextUnderline_Annotation.Run();
//// Post/Add Watermark annotations
//Add_Watermark_Annotation.Run();
//// Post/Add multiple annotations
//Add_Multiple_Annotations.Run();
//// ***********************************************************
/////// ***** GET ANNOTATIONS *****
//// ***********************************************************
//// Get document annotation from File
//Get_Annotation.Run();
//// Get document with annotation result as Stream
//Get_Export_Document.Run();
//// Get document as PDF with annotation result as Stream
//Get_PDF.Run();
//// ***********************************************************
/////// ***** DELETE ANNOTATIONS *****
//// ***********************************************************
////// Delete annotation from document
//Delete_Annotation.Run();
}
}
}
using System;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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);
}
}
}
}
using System;
using System.IO;
using GroupDocs.Annotation.Cloud.Sdk.Api;
using GroupDocs.Annotation.Cloud.Sdk.Client;
using GroupDocs.Annotation.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Annotation.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\\Annotationdocs\\one-page.docx", FileMode.Open);
var request = new UploadFileRequest("Annotationdocs/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