Skip to content

Commit

Permalink
Updated unlocking annotation power examples
Browse files Browse the repository at this point in the history
  • Loading branch information
muqarrab-aspose committed Apr 17, 2024
1 parent 181d5dd commit 0a5c8df
Show file tree
Hide file tree
Showing 17 changed files with 1,296 additions and 704 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,124 @@
title: Add Distance Annotation to Document
linktitle: Add Distance Annotation to Document
second_title: GroupDocs.Annotation .NET API
description:
description: Learn how to add distance annotations to documents using GroupDocs.Annotation for .NET. Enhance collaboration and communication effortlessly.
type: docs
weight: 12
url: /net/unlocking-annotation-power/add-distance-annotation/
---
## Introduction
In this tutorial, you will learn how to add a distance annotation to a document using GroupDocs.Annotation for .NET. Follow these steps to accomplish the task:
## Prerequisites

Ensure that you have the following prerequisites in place before proceeding:

- GroupDocs.Annotation for .NET Library: Download and install the GroupDocs.Annotation for .NET library from [this link](https://releases.groupdocs.com/annotation/net/).
- Document to Annotate: Prepare the document (e.g., PDF) to which you want to add the distance annotation.
- Development Environment: Set up your development environment with Visual Studio or any other IDE of your choice.

## Import Namespaces

Before you begin, make sure to include the necessary namespaces in your code. These namespaces are essential for accessing the required classes and methods.

## Complete Source Code
```csharp
using System;
using System.Collections.Generic;
using System.IO;
using GroupDocs.Annotation.Models;
using GroupDocs.Annotation.Models.AnnotationModels;
using GroupDocs.Annotation.Options;
```


namespace GroupDocs.Annotation.Examples.CSharp.BasicUsage.AddAnnotationToTheDocument
## Step 1: Initialize Annotator

Begin by initializing the `Annotator` object with the path to the document you want to annotate.

```csharp
using (Annotator annotator = new Annotator("input.pdf"))
{
/// <summary>
/// This example demonstrates adding distance annotation.
/// </summary>
class AddDistanceAnnotation
// Annotation code will go here
}
```

## Step 2: Create Distance Annotation

Now, create a `DistanceAnnotation` object and configure its properties such as box dimensions, message, opacity, pen color, etc.

```csharp
DistanceAnnotation distance = new DistanceAnnotation
{
Box = new Rectangle(200, 150, 200, 30),
CreatedOn = DateTime.Now,
Message = "This is distance annotation",
Opacity = 0.7,
PageNumber = 0,
PenColor = 65535,
PenStyle = PenStyle.Dot,
PenWidth = 3,
Replies = new List<Reply>
{
public static void Run()
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf"));

using (Annotator annotator = new Annotator("input.pdf"))
{
DistanceAnnotation distance = new DistanceAnnotation
{
Box = new Rectangle(200, 150, 200, 30),
CreatedOn = DateTime.Now,
Message = "This is distance annotation",
Opacity = 0.7,
PageNumber = 0,
PenColor = 65535,
PenStyle = PenStyle.Dot,
PenWidth = 3,
Replies = new List<Reply>
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(distance);
annotator.Save(outputPath);
}
Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}.");
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
}
};
```

## Step 3: Add Annotation

Add the created distance annotation to the document using the `Add` method of the annotator object.

```csharp
annotator.Add(distance);
```

## Step 4: Save Document

Save the annotated document to the desired location on your system.

```csharp
string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf"));
annotator.Save(outputPath);
```

## Step 5: Display Confirmation

Finally, display a message confirming the successful saving of the annotated document.

```csharp
Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}.");
```

## Conclusion

Adding distance annotations to documents using GroupDocs.Annotation for .NET is a straightforward process. By following the steps outlined in this tutorial, you can enhance your documents with valuable annotations, facilitating better collaboration and communication.

## FAQ's

### Q: Can I customize the appearance of the distance annotation?

A: Yes, you can customize various properties such as color, opacity, line style, etc., to suit your requirements.

### Q: Does GroupDocs.Annotation support annotations on different types of documents?

A: Yes, GroupDocs.Annotation supports annotations on a wide range of document formats including PDF, Word, Excel, PowerPoint, and more.

### Q: Is there a free trial available for GroupDocs.Annotation?

A: Yes, you can access a free trial of GroupDocs.Annotation from [this link](https://releases.groupdocs.com/).

### Q: Where can I find the documentation for GroupDocs.Annotation for .NET?

A: You can refer to the detailed documentation available [here](https://reference.groupdocs.com/annotation/net/).

### Q: How can I get support or assistance with GroupDocs.Annotation?

A: You can seek support and assistance from the GroupDocs.Annotation community forum [here](https://forum.groupdocs.com/c/annotation/10).
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,89 @@
title: Add Ellipse Annotation to Document
linktitle: Add Ellipse Annotation to Document
second_title: GroupDocs.Annotation .NET API
description:
description: Learn how to add ellipse annotations to documents in .NET using GroupDocs.Annotation. Enhance collaboration and communication effortlessly.
type: docs
weight: 13
url: /net/unlocking-annotation-power/add-ellipse-annotation/
---
## Introduction
In this tutorial, you'll learn how to add an ellipse annotation to a document using GroupDocs.Annotation for .NET. This step-by-step guide will walk you through the process, ensuring that you understand each step clearly.
## Prerequisites
Before you begin, make sure you have the following:
1. GroupDocs.Annotation for .NET: Make sure you have downloaded and installed GroupDocs.Annotation for .NET. You can download it from [here](https://releases.groupdocs.com/annotation/net/).
2. IDE (Integrated Development Environment): You'll need an IDE installed on your system, such as Visual Studio, to write and execute the code.

## Complete Source Code
## Import Namespaces
First, import the necessary namespaces to your project:
```csharp
using System;
using System.Collections.Generic;
using System.IO;
using GroupDocs.Annotation.Models;
using GroupDocs.Annotation.Models.AnnotationModels;
using GroupDocs.Annotation.Options;

namespace GroupDocs.Annotation.Examples.CSharp.BasicUsage.AddAnnotationToTheDocument
```
## Step 1: Set Output Path
Define the output path where the annotated document will be saved:
```csharp
string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf"));
```
## Step 2: Initialize Annotator
Initialize the annotator by providing the input document path:
```csharp
using (Annotator annotator = new Annotator("input.pdf"))
{
```
## Step 3: Create Ellipse Annotation
Create an instance of the `EllipseAnnotation` class and set its properties:
```csharp
EllipseAnnotation ellipse = new EllipseAnnotation
{
/// <summary>
/// This example demonstrates adding ellipse annotation.
/// </summary>
class AddEllipseAnnotation
BackgroundColor = 65535,
Box = new Rectangle(100, 100, 100, 100),
CreatedOn = DateTime.Now,
Message = "This is ellipse annotation",
Opacity = 0.7,
PageNumber = 0,
PenColor = 65535,
PenStyle = PenStyle.Dot,
PenWidth = 3,
Replies = new List<Reply>
{
public static void Run()
new Reply
{
string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf"));

using (Annotator annotator = new Annotator("input.pdf"))
{
EllipseAnnotation ellipse = new EllipseAnnotation
{
BackgroundColor = 65535,
Box = new Rectangle(100, 100, 100, 100),
CreatedOn = DateTime.Now,
Message = "This is ellipse annotation",
Opacity = 0.7,
PageNumber = 0,
PenColor = 65535,
PenStyle = PenStyle.Dot,
PenWidth = 3,
Replies = new List<Reply>
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(ellipse);
annotator.Save(outputPath);
}
Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}.");
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
}

};
```
## Step 4: Add Annotation
Add the ellipse annotation to the document:
```csharp
annotator.Add(ellipse);
```
## Step 5: Save Document
Save the annotated document to the output path:
```csharp
annotator.Save(outputPath);
```

## Conclusion
Congratulations! You've successfully added an ellipse annotation to a document using GroupDocs.Annotation for .NET. You can now integrate this functionality into your .NET applications to enhance document collaboration and communication.
## FAQ's
### Can I customize the appearance of the ellipse annotation?
Yes, you can customize various properties such as background color, border color, opacity, etc., according to your requirements.
### Is GroupDocs.Annotation for .NET compatible with all document formats?
GroupDocs.Annotation for .NET supports a wide range of document formats including PDF, DOCX, PPTX, XLSX, and more.
### Can I add multiple annotations to a single document?
Yes, you can add multiple annotations including ellipses, rectangles, text, etc., to a single document.
### Is there a trial version available for testing purposes?
Yes, you can download a free trial version from [here](https://releases.groupdocs.com/) to evaluate its features.
### Where can I get technical support for GroupDocs.Annotation for .NET?
You can get technical support from the GroupDocs.Annotation community forum [here](https://forum.groupdocs.com/c/annotation/10).
Loading

0 comments on commit 0a5c8df

Please sign in to comment.