Skip to content

Commit

Permalink
Basic Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
adilfazal-aspose committed Apr 8, 2024
1 parent 74c5206 commit 89c753a
Show file tree
Hide file tree
Showing 63 changed files with 3,016 additions and 0 deletions.
23 changes: 23 additions & 0 deletions content/english/net/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Tutorials and Examples of GroupDocs.Annotation for .NET
linktitle: GroupDocs.Annotation for .NET Tutorials
type: docs
weight: 10
url: /net/
description:
is_root: true
---

### [Document Loading Essentials](./document-loading-essentials/)

### [Getting Started](./getting-started/)

### [Advanced Usage](./advanced-usage/)

### [Unlocking Annotation Power](./unlocking-annotation-power/)

### [Document Components](./document-components/)

### [Removing Annotations](./removing-annotations/)

### [Applying Licenses](./applying-licenses/)
25 changes: 25 additions & 0 deletions content/english/net/advanced-usage/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Advanced Usage
linktitle: Advanced Usage
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 22
url: /net/advanced-usage/
---

## Advanced Usage Tutorials
### [Change Image Quality](./change-image-quality/)
### [Export Annotations from XML File](./export-annotations-xml-file/)
### [Generate Document Pages Preview](./generate-document-pages-preview/)
### [Generate Preview without Annotations](./generate-preview-without-annotations/)
### [Generate Preview without Comments](./generate-preview-without-comments/)
### [Generate Preview Worksheet Columns](./generate-preview-worksheet-columns/)
### [Get All Version Keys on Document](./get-all-version-keys-document/)
### [Get Document Text Content Information](./get-document-text-content-information/)
### [Get List of Annotations using Version Key](./get-list-annotations-version-key/)
### [Import Annotations from Document](./import-annotations-from-document/)
### [Loading Custom Fonts](./loading-custom-fonts/)
### [Put Image Annotation over Text](./put-image-annotation-over-text/)
### [Rotating PDF Documents](./rotating-pdf-documents/)
### [Set Document Preview Resolution](./set-document-preview-resolution/)
35 changes: 35 additions & 0 deletions content/english/net/advanced-usage/change-image-quality/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Change Image Quality
linktitle: Change Image Quality
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 10
url: /net/advanced-usage/change-image-quality/
---

## Complete Source Code
```csharp
using System;
using System.IO;
using GroupDocs.Annotation;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
class ChangeImageQuality
{
public static void Run()
{
using (Annotator annotator = new Annotator("input.pdf-file")) // specify the path to the input PDF file
{
string dataDir = "input.pdf"; // specify the path to the input PDF file
string data = "image.jpg"; // the path to the JPG file
int pageNumber = 1; // set the page where the image will be inserted
int imageQuality = 10; // set image quality
annotator.Document.AddImageToDocument(dataDir, data, pageNumber, imageQuality);
}
}
}
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Export Annotations from XML File
linktitle: Export Annotations from XML File
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 11
url: /net/advanced-usage/export-annotations-xml-file/
---

## Complete Source Code
```csharp
using System;
using System.IO;
using GroupDocs.Annotation;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
class ExportAnnotationsFromXMLFile
{
public static void Run()
{
using (Annotator annotator = new Annotator("input.pdf-file")) // specify the path to the input PDF file
{
annotator.ExportAnnotationsFromXMLFile("input.XML-file"); // specify the path to the input XML file
annotator.Save("result_export");
}
}
}
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Generate Document Pages Preview
linktitle: Generate Document Pages Preview
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 12
url: /net/advanced-usage/generate-document-pages-preview/
---

## Complete Source Code
```csharp
using GroupDocs.Annotation.Options;
using System;
using System.IO;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
/// <summary>
/// This example demonstrates annotating generating previews from document
/// </summary>
internal class GenerateDocumentPagesPreview
{
public static void Run()
{
using (Annotator annotator = new Annotator("input.pdf"))
{
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
{
var pagePath = Path.Combine(Constants.GetOutputDirectoryPath(), $"result_{pageNumber}.png");
return File.Create(pagePath);
});
previewOptions.PreviewFormat = PreviewFormats.PNG;

previewOptions.PageNumbers = new int[] { 1, 2, 3, 4 };
annotator.Document.GeneratePreview(previewOptions);
}
Console.WriteLine($"\nDocument previews generated successfully.\nCheck output in {Constants.GetOutputDirectoryPath()}.");
}
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Generate Preview without Annotations
linktitle: Generate Preview without Annotations
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 13
url: /net/advanced-usage/generate-preview-without-annotations/
---

## Complete Source Code
```csharp
using System.IO;
using GroupDocs.Annotation.Options;

namespace GroupDocs.Annotation.Examples.CSharp
{
/// <summary>
/// This example demonstrates generating preview of document without rendering comments
/// </summary>
class GeneratePreviewWithoutAnnotations
{
public static void Run()
{
using (Annotator annotator = new Annotator("annotated.pdf"_DOCX))
{
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
{
var pagePath = $"result{pageNumber}.png";
return File.Create(pagePath);
});

previewOptions.PreviewFormat = PreviewFormats.PNG;
previewOptions.PageNumbers = new int[] {1, 2, 3, 4, 5, 6};
previewOptions.RenderAnnotations = false;
annotator.Document.GeneratePreview(previewOptions);
}
}
}
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Generate Preview without Comments
linktitle: Generate Preview without Comments
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 14
url: /net/advanced-usage/generate-preview-without-comments/
---

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

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
/// <summary>
/// This example demonstrates generating preview of document without rendering comments
/// </summary>
class GeneratePreviewWithoutComments
{
public static void Run()
{
using (Annotator annotator = new Annotator("annotated.pdf"_DOCX))
{
PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
{
var pagePath = $"result{pageNumber}.png";
return File.Create(pagePath);
});
previewOptions.PreviewFormat = PreviewFormats.PNG;
previewOptions.PageNumbers = new int[] { 1, 2, 3, 4, 5, 6 };
previewOptions.RenderComments = false;
annotator.Document.GeneratePreview(previewOptions);
}
}
}
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Generate Preview Worksheet Columns
linktitle: Generate Preview Worksheet Columns
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 15
url: /net/advanced-usage/generate-preview-worksheet-columns/
---

## Complete Source Code
```csharp
using GroupDocs.Annotation;
using GroupDocs.Annotation.Options;
using System;
using System.IO;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
/// <summary>
/// This example demonstrates generating previews from document with specified worksheet columns
/// </summary>
internal class GeneratePreviewWorksheetColumns
{
public static void Run()
{
PreviewOptions previewOptions =
new PreviewOptions(
pageNumber => new FileStream(Path.Combine(Constants.GetOutputDirectoryPath(), $"cells_page{pageNumber}.png"), FileMode.Create),
(number, stream) => stream.Dispose()
);
previewOptions.WorksheetColumns.Add(new WorksheetColumnsRange("Sheet1", 2, 3));
previewOptions.WorksheetColumns.Add(new WorksheetColumnsRange("Sheet1", 1, 1));

using (Annotator annotator = new Annotator("input.xlsx"))
{
annotator.Document.GeneratePreview(previewOptions);
}
Console.WriteLine($"\nDocument previews generated successfully.\nCheck output in {Constants.GetOutputDirectoryPath()}.");
}
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Get All Version Keys on Document
linktitle: Get All Version Keys on Document
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 16
url: /net/advanced-usage/get-all-version-keys-document/
---

## Complete Source Code
```csharp
using System;
using System.Collections.Generic;
using System.Text;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
/// <summary>
/// This example demonstrates getting all version keys from document
/// </summary>
class GetAllVersionKeysOnDocument
{
public static void Run()
{
using (Annotator annotator = new Annotator("annotated_with_versions.pdf"))
{
List<object> versionKeys = annotator.GetVersionsList();
}
}
}
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: Get Document Text Content Information
linktitle: Get Document Text Content Information
second_title: GroupDocs.Annotation .NET API
description:
type: docs
weight: 17
url: /net/advanced-usage/get-document-text-content-information/
---

## Complete Source Code
```csharp
using System;
using GroupDocs.Annotation.Models;

namespace GroupDocs.Annotation.Examples.CSharp.AdvancedUsage
{
/// <summary>
/// This example demonstrates how to get an information about document's text content
/// </summary>
class GetDocumentTextContentInformation
{
public static void Run()
{
using (Annotator annotator = new Annotator("annotated.pdf"_DOCX))
{
IDocumentInfo documentInfo = annotator.Document.GetDocumentInfo();

foreach (PageInfo page in documentInfo.PagesInfo)
{
//Here you can get information about page through the 'page' object.
Console.WriteLine("Page number {0}, width: {1} and height: {2}", page.PageNumber, page.Width, page.Height);

foreach (TextLineInfo textLine in page.TextLines)
{
//Here you can get information about every text line on page, through the 'textLine' object.
Console.WriteLine("\tText line. '{0}'", textLine.Text);
Console.WriteLine("\t\tText width {0} and height {1}. Top indent: {2}, left indent: {3}",
textLine.Width, textLine.Height, textLine.TopIndent, textLine.LeftIndent);
}
}
}
}
}
}

```
Loading

0 comments on commit 89c753a

Please sign in to comment.