PdfAnnotationAgentTools Class
Provides AI agent tools for PDF annotation and modification operations. Handles watermarking, digital signatures, and annotation management.
Inherited Members
Namespace: Syncfusion.AI.AgentTools.PDF
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class PdfAnnotationAgentTools : AgentToolBase<PdfDocumentBase>
Constructors
PdfAnnotationAgentTools(DocumentStorageManager)
Initializes a new instance of the PdfAnnotationAgentTools class (Mode 2 � DocumentStorage).
Declaration
public PdfAnnotationAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
PdfAnnotationAgentTools(PdfDocumentManager)
Initializes a new instance of the PdfAnnotationAgentTools class (Mode 1 � InMemory).
Declaration
public PdfAnnotationAgentTools(PdfDocumentManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentManager | manager | The PDF document manager. |
Methods
ExportAnnotations(String, AnnotationDataFormat, String)
Exports annotations from a PDF document in the specified format.
Declaration
[Tool(Name = "ExportAnnotations", Description = "Exports annotations from a PDF document into XFDF, FDF, or JSON format. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ExportAnnotations([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The export format (XFDF, FDF, JSON)")] AnnotationDataFormat format, [ToolParameter(Description = "Optional: Export file or folder path")] string exportFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | |
| AnnotationDataFormat | format | |
| System.String | exportFilePath |
Returns
| Type |
|---|
| AgentToolResult |
Remarks
Export behavior:
ExportFormFields(String, DataFormat, String)
Exports form field data from a PDF document into FDF, XFDF, or XML format.
Declaration
[Tool(Name = "ExportFormFields", Description = "Exports form field data from a PDF document into FDF, XFDF, or XML format. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ExportFormFields([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "Export format (FDF, XFDF, XML)")] DataFormat format, [ToolParameter(Description = "Optional: Export file or folder path")] string exportPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| DataFormat | format | Export format (FDF, XFDF, XML). |
| System.String | exportPath | Optional export file or folder path. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the exported form field data or the export file path. |
ImportAnnotations(String, AnnotationDataFormat, String, String)
Imports annotations into a PDF document from an XFDF, FDF, or JSON file.
Declaration
[Tool(Name = "ImportAnnotations", Description = "Imports annotations into a PDF document from XFDF, FDF, or JSON. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ImportAnnotations([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The import format (XFDF, FDF, JSON)")] AnnotationDataFormat format, [ToolParameter(Description = "Annotation file path (XFDF, FDF, or JSON file)")] string importFilePath, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| AnnotationDataFormat | format | The import format (XFDF, FDF, JSON). |
| System.String | importFilePath | Annotation file path (XFDF, FDF, or JSON file). |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the document ID and import details. |
ImportFormFields(String, DataFormat, String, String)
Imports form field data into a PDF document from an FDF, XFDF, or XML file.
Declaration
[Tool(Name = "ImportFormFields", Description = "Imports form field data into a PDF document from FDF, XFDF, or XML. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ImportFormFields([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "Import format (FDF, XFDF, XML)")] DataFormat format, [ToolParameter(Description = "Form field data file path (FDF/XFDF/XML file)")] string sourcePdfPath = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| DataFormat | format | Import format (FDF, XFDF, XML). |
| System.String | sourcePdfPath | Form field data file path (FDF/XFDF/XML file). |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the document ID and import details. |
WatermarkPdf(String, String, Nullable<Int32>, Single, Single, Byte[], Single, String)
Applies a configurable text watermark to all pages of a PDF document. Supports opacity, rotation, color, and custom positioning.
Declaration
[Tool(Name = "WatermarkPdf", Description = "Applies a configurable text watermark to all pages of a PDF document. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode). Supports opacity, rotation, color, and positioning.")]
public AgentToolResult WatermarkPdf([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The watermark text to apply.")] string watermarkText, [ToolParameter(Description = "Optional rotation angle in degrees. Defaults to 45.")] Nullable<int> rotation = null, [ToolParameter(Description = "X coordinate. Use -1 to center horizontally.")] float locationX = -1F, [ToolParameter(Description = "Y coordinate. Use -1 to center vertically.")] float locationY = -1F, [ToolParameter(Description = "Optional watermark color (RGB). Defaults to gray. The color ranges must be 0 to 255. Example: Blue [0,0,255]")] byte[] watermarkColor = null, [ToolParameter(Description = "Opacity percentage (0�100). Defaults to 50.")] float opacity = 50F, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.String | watermarkText | The watermark text to apply. |
| System.Nullable<System.Int32> | rotation | Optional rotation angle in degrees. Defaults to 45. |
| System.Single | locationX | X coordinate. Use -1 to center horizontally. |
| System.Single | locationY | Y coordinate. Use -1 to center vertically. |
| System.Byte[] | watermarkColor | Optional watermark color (RGB). Defaults to gray. |
| System.Single | opacity | Opacity percentage (0–100). Defaults to 50. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the document ID and watermark details. |