From 839edc20e25f20604c056765c5e6f257a3a331b3 Mon Sep 17 00:00:00 2001 From: Muhammad Muqarrab Date: Tue, 16 Apr 2024 16:41:18 +0500 Subject: [PATCH] Updated document components examples --- .../english/net/document-components/_index.md | 5 +- .../add-button-component-to-pdf/_index.md | 100 ++++++++------- .../add-checkbox-component-to-pdf/_index.md | 106 ++++++++++------ .../add-dropdown-component-to-pdf/_index.md | 119 +++++++++++------- 4 files changed, 203 insertions(+), 127 deletions(-) diff --git a/content/english/net/document-components/_index.md b/content/english/net/document-components/_index.md index 2417cf1..f0aea67 100644 --- a/content/english/net/document-components/_index.md +++ b/content/english/net/document-components/_index.md @@ -10,5 +10,8 @@ url: /net/document-components/ ## Document Components Tutorials ### [Add Button Component to PDF Document](./add-button-component-to-pdf/) +Enhance your PDF documents with interactive button components using Groupdocs.Annotation for .NET. Follow our step-by-step tutorial for seamless integration. ### [Add Checkbox Component to PDF Document](./add-checkbox-component-to-pdf/) -### [Add Dropdown Component to PDF Document](./add-dropdown-component-to-pdf/) \ No newline at end of file +Learn how to add a Checkbox Component to PDF documents using Groupdocs.Annotation for .NET. Enhance your PDFs with interactive elements. +### [Add Dropdown Component to PDF Document](./add-dropdown-component-to-pdf/) +Learn how to add dropdown components to PDFs using GroupDocs.Annotation for .NET. Follow our step-by-step guide for seamless integration. \ No newline at end of file diff --git a/content/english/net/document-components/add-button-component-to-pdf/_index.md b/content/english/net/document-components/add-button-component-to-pdf/_index.md index d9fe8e4..0f933f3 100644 --- a/content/english/net/document-components/add-button-component-to-pdf/_index.md +++ b/content/english/net/document-components/add-button-component-to-pdf/_index.md @@ -2,13 +2,20 @@ title: Add Button Component to PDF Document linktitle: Add Button Component to PDF Document second_title: GroupDocs.Annotation .NET API -description: +description: Enhance your PDF documents with interactive button components using Groupdocs.Annotation for .NET. Follow our step-by-step tutorial for seamless integration. type: docs weight: 10 url: /net/document-components/add-button-component-to-pdf/ --- +## Introduction +In this tutorial, we will guide you through the process of adding a Button Component to a PDF document using Groupdocs.Annotation for .NET. This step-by-step guide will ensure that you can easily integrate this feature into your project. +## Prerequisites +Before you begin, ensure you have the following prerequisites in place: +1. Groupdocs.Annotation for .NET: Make sure you have installed Groupdocs.Annotation for .NET library. You can download it from [here](https://releases.groupdocs.com/annotation/net/). +2. Development Environment: Have a suitable development environment set up with .NET framework installed. -## Complete Source Code +## Import Namespaces +Before proceeding, import the necessary namespaces into your project: ```csharp using System; using System.Collections.Generic; @@ -17,51 +24,60 @@ using GroupDocs.Annotation.Models; using GroupDocs.Annotation.Models.AnnotationModels; using GroupDocs.Annotation.Models.FormatSpecificComponents.Pdf; using GroupDocs.Annotation.Options; - -namespace GroupDocs.Annotation.Examples.CSharp.BasicUsage.AddAnnotationToTheDocument +``` +## Step 1: Initialize Output Path +```csharp +string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); +``` +## Step 2: Add Button Component +```csharp +using (Annotator annotator = new Annotator("input.pdf")) { - /// - /// This example demonstrates adding button component. - /// - class AddButtonComponent + ButtonComponent button = new ButtonComponent { - public static void Run() + Box = new Rectangle(100, 100, 100, 100), + PenColor = 65535, + Style = BorderStyle.Dashed, + BorderWidth = 0, + BorderColor = 0, + AlternateName = "Name", + PartialName = "Patial Name", + NormalCaption = "Caption", + ButtonColor = 16761035, + Replies = new List { - string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); - - using (Annotator annotator = new Annotator("input.pdf")) + new Reply { - ButtonComponent button = new ButtonComponent - { - Box = new Rectangle(100, 100, 100, 100), - PenColor = 65535, - Style = BorderStyle.Dashed, - BorderWidth = 0, - BorderColor = 0, - AlternateName = "Name", - PartialName = "Patial Name", - NormalCaption = "Caption", - ButtonColor = 16761035, - Replies = new List - { - new Reply - { - Comment = "First comment", - RepliedOn = DateTime.Now - }, - new Reply - { - Comment = "Second comment", - RepliedOn = DateTime.Now - } - } - }; - annotator.Add(button); - annotator.Save("result.pdf"); + Comment = "First comment", + RepliedOn = DateTime.Now + }, + new Reply + { + Comment = "Second comment", + RepliedOn = DateTime.Now } - - Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}."); } - } + }; + annotator.Add(button); + annotator.Save("result.pdf"); } ``` +## Step 3: Display Output Path +```csharp +Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}."); +``` +Congratulations! You have successfully added a Button Component to a PDF document using Groupdocs.Annotation for .NET. + +## Conclusion +In this tutorial, we have demonstrated how to incorporate Button Components into PDF documents using Groupdocs.Annotation for .NET. By following these steps, you can enhance your PDF documents with interactive features. +## FAQ's +### Can I customize the appearance of the button? +Yes, you can customize various properties such as size, color, and style of the button component according to your requirements. +### Is Groupdocs.Annotation for .NET compatible with all PDF versions? +Groupdocs.Annotation for .NET supports a wide range of PDF versions, ensuring compatibility with most documents. +### Can I add multiple button components to a single PDF document? +Absolutely, you can add as many button components as needed to a PDF document using Groupdocs.Annotation for .NET. +### Does Groupdocs.Annotation for .NET offer support for other file formats? +Yes, in addition to PDF, Groupdocs.Annotation for .NET supports various other document formats including DOCX, PPTX, and XLSX. +### Is there a trial version available for testing purposes? +Yes, you can access a free trial of Groupdocs.Annotation for .NET from [here](https://releases.groupdocs.com/). diff --git a/content/english/net/document-components/add-checkbox-component-to-pdf/_index.md b/content/english/net/document-components/add-checkbox-component-to-pdf/_index.md index d25ba55..3fe2a20 100644 --- a/content/english/net/document-components/add-checkbox-component-to-pdf/_index.md +++ b/content/english/net/document-components/add-checkbox-component-to-pdf/_index.md @@ -2,13 +2,19 @@ title: Add Checkbox Component to PDF Document linktitle: Add Checkbox Component to PDF Document second_title: GroupDocs.Annotation .NET API -description: +description: Learn how to add a Checkbox Component to PDF documents using Groupdocs.Annotation for .NET. Enhance your PDFs with interactive elements. type: docs weight: 11 url: /net/document-components/add-checkbox-component-to-pdf/ --- +## Introduction +In this tutorial, we'll guide you through the process of adding a Checkbox Component to a PDF document using Groupdocs.Annotation for .NET. +## Prerequisites +Before we begin, ensure you have the following: +1. Groupdocs.Annotation for .NET SDK: You can download it from [here](https://releases.groupdocs.com/annotation/net/). +2. Development Environment: Make sure you have a .NET development environment set up. -## Complete Source Code +## Import Namespaces ```csharp using System; using System.Collections.Generic; @@ -17,46 +23,68 @@ using GroupDocs.Annotation.Models; using GroupDocs.Annotation.Models.AnnotationModels; using GroupDocs.Annotation.Models.FormatSpecificComponents.Pdf; using GroupDocs.Annotation.Options; - -namespace GroupDocs.Annotation.Examples.CSharp.BasicUsage.AddAnnotationToTheDocument +``` +Now, let's break down the example into multiple steps: +## Step 1: Define Output Path +```csharp +string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); +``` +Here, we define the output path where the modified PDF document will be saved. +## Step 2: Initialize Annotator +```csharp +using (Annotator annotator = new Annotator("input.pdf")) +``` +Initialize the `Annotator` object by passing the input PDF document path. +## Step 3: Create Checkbox Component +```csharp +CheckBoxComponent checkBox = new CheckBoxComponent { - /// - /// This example demonstrates adding checkBox component. - /// - class AddCheckBoxComponent + Checked = true, + Box = new Rectangle(100, 100, 100, 100), + PenColor = 65535, + Style = BoxStyle.Star, + Replies = new List { - public static void Run() + new Reply { - string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); - - using (Annotator annotator = new Annotator("input.pdf")) - { - CheckBoxComponent checkBox = new CheckBoxComponent - { - Checked = true, - Box = new Rectangle(100, 100, 100, 100), - PenColor = 65535, - Style = BoxStyle.Star, - Replies = new List - { - new Reply - { - Comment = "First comment", - RepliedOn = DateTime.Now - }, - new Reply - { - Comment = "Second comment", - RepliedOn = DateTime.Now - } - } - }; - annotator.Add(checkBox); - annotator.Save("result.pdf"); - } - - Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}."); + Comment = "First comment", + RepliedOn = DateTime.Now + }, + new Reply + { + Comment = "Second comment", + RepliedOn = DateTime.Now } } -} +}; +``` +Create a `CheckBoxComponent` object and customize its properties like `Checked`, `Box` dimensions, `PenColor`, `Style`, and add some replies. +## Step 4: Add Checkbox Component +```csharp +annotator.Add(checkBox); +``` +Add the created checkbox component to the PDF document. +## Step 5: Save Document +```csharp +annotator.Save("result.pdf"); +``` +Save the modified PDF document with the checkbox component. +## Step 6: Display Output Path +```csharp +Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}."); ``` +Display the path where the modified PDF document is saved. + +## Conclusion +In this tutorial, we've learned how to add a Checkbox Component to a PDF document using Groupdocs.Annotation for .NET. With this knowledge, you can enhance your PDF documents with interactive elements. +## FAQ's +### Can I customize the appearance of the checkbox? +Yes, you can customize various properties such as color, style, and size according to your requirements. +### Is Groupdocs.Annotation for .NET suitable for commercial use? +Yes, Groupdocs.Annotation for .NET offers commercial licenses for businesses. +### Can I try Groupdocs.Annotation for .NET before purchasing? +Yes, you can avail of a free trial from [here](https://releases.groupdocs.com/). +### Where can I find support for Groupdocs.Annotation for .NET? +You can find support and resources on the [Groupdocs forum](https://forum.groupdocs.com/c/annotation/10). +### Do I need a temporary license for testing purposes? +You can obtain a temporary license for testing from [here](https://purchase.groupdocs.com/temporary-license/). diff --git a/content/english/net/document-components/add-dropdown-component-to-pdf/_index.md b/content/english/net/document-components/add-dropdown-component-to-pdf/_index.md index 85b9548..0e8bfe4 100644 --- a/content/english/net/document-components/add-dropdown-component-to-pdf/_index.md +++ b/content/english/net/document-components/add-dropdown-component-to-pdf/_index.md @@ -2,13 +2,21 @@ title: Add Dropdown Component to PDF Document linktitle: Add Dropdown Component to PDF Document second_title: GroupDocs.Annotation .NET API -description: +description: Learn how to add dropdown components to PDFs using GroupDocs.Annotation for .NET. Follow our step-by-step guide for seamless integration. type: docs weight: 12 url: /net/document-components/add-dropdown-component-to-pdf/ --- +## Introduction +GroupDocs.Annotation for .NET provides a powerful set of tools for annotating PDF documents programmatically. One useful feature is the ability to add dropdown components to PDF documents, enhancing their interactivity and usability. +## Prerequisites +Before getting started, ensure you have the following: +1. GroupDocs.Annotation for .NET: Download and install the library from [here](https://releases.groupdocs.com/annotation/net/). +2. Development Environment: Have a .NET development environment set up. +3. PDF Document: Prepare the PDF document to which you want to add the dropdown component. -## Complete Source Code +## Importing Namespaces +Ensure that you import the necessary namespaces into your project: ```csharp using System; using System.Collections.Generic; @@ -17,52 +25,73 @@ using GroupDocs.Annotation.Models; using GroupDocs.Annotation.Models.AnnotationModels; using GroupDocs.Annotation.Models.FormatSpecificComponents.Pdf; using GroupDocs.Annotation.Options; - -namespace GroupDocs.Annotation.Examples.CSharp.BasicUsage.AddAnnotationToTheDocument +``` +## Step 1: Set Output Path +Define the output path where the modified document will be saved: +```csharp +string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); +``` +## Step 2: Initialize Annotator +Create an instance of the `Annotator` class by passing the path of the input PDF document: +```csharp +using (Annotator annotator = new Annotator("input.pdf")) +``` +## Step 3: Create Dropdown Component +Define the properties of the dropdown component: +```csharp +DropdownComponent dropdown = new DropdownComponent { - /// - /// This example demonstrates adding area annotation. - /// - class AddDropdownComponent + Options = new List { "Item1", "Item2", "Item3" }, + SelectedOption = null, + Placeholder = "Choose option", + Box = new Rectangle(100, 100, 100, 100), + CreatedOn = DateTime.Now, + Message = "This is dropdown component", + PageNumber = 0, + PenColor = 65535, + PenStyle = PenStyle.Dot, + PenWidth = 3, + Replies = new List { - public static void Run() + new Reply { - string outputPath = Path.Combine(Constants.GetOutputDirectoryPath(), "result" + Path.GetExtension("input.pdf")); - - using (Annotator annotator = new Annotator("input.pdf")) - { - DropdownComponent dropdown = new DropdownComponent - { - Options = new List { "Item1", "Item2", "Item3" }, - SelectedOption = null, - Placeholder = "Choose option", - Box = new Rectangle(100, 100, 100, 100), - CreatedOn = DateTime.Now, - Message = "This is dropdown component", - PageNumber = 0, - PenColor = 65535, - PenStyle = PenStyle.Dot, - PenWidth = 3, - Replies = new List - { - new Reply - { - Comment = "First comment", - RepliedOn = DateTime.Now - }, - new Reply - { - Comment = "Second comment", - RepliedOn = DateTime.Now - } - } - }; - annotator.Add(dropdown); - annotator.Save("result.pdf"); - } - - 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 Dropdown Component +Add the dropdown component to the PDF document: +```csharp +annotator.Add(dropdown); +``` +## Step 5: Save Document +Save the modified document: +```csharp +annotator.Save("result.pdf"); +``` +## Step 6: Display Output Path +Display a message indicating the successful saving of the document along with the output path: +```csharp +Console.WriteLine($"\nDocument saved successfully.\nCheck output in {outputPath}."); ``` + +## Conclusion +In this tutorial, we've explored how to enhance PDF documents by adding dropdown components using GroupDocs.Annotation for .NET. By following the step-by-step guide, you can easily integrate this functionality into your .NET applications, providing users with interactive and dynamic document viewing experiences. +## FAQ's +### Can I customize the appearance of the dropdown component? +Yes, you can customize various properties such as options, placeholder text, box dimensions, pen color, and style according to your requirements. +### Is GroupDocs.Annotation for .NET compatible with all versions of .NET? +Yes, GroupDocs.Annotation for .NET is compatible with all major versions of the .NET framework. +### Can I add multiple dropdown components to a single PDF document? +Absolutely, you can add as many dropdown components as needed to a PDF document. +### Does GroupDocs.Annotation for .NET support other annotation types? +Yes, GroupDocs.Annotation for .NET supports various annotation types including text, area, point, and strikeout annotations. +### Is there a trial version available for testing purposes? +Yes, you can access the trial version [here](https://releases.groupdocs.com/).