PdfDocumentAgentTools Class
Provides AI agent tools for PDF document lifecycle management and I/O operations. Handles document creation, import, export, and manager.
Inherited Members
Namespace: Syncfusion.AI.AgentTools.PDF
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class PdfDocumentAgentTools : AgentToolBase
Constructors
PdfDocumentAgentTools(PdfDocumentManager, String)
Initializes a new instance of the PdfDocumentAgentTools class.
Declaration
public PdfDocumentAgentTools(PdfDocumentManager manager, string outputDirectory = null)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentManager | manager | The PDF document manager. |
| System.String | outputDirectory | Optional output directory for file operations. |
Methods
CreatePdfDocument(String, String)
Creates a PDF document in memory or loads an existing PDF from a file.
Declaration
[Tool(Name = "CreatePdfDocument", Description = "Create a PDF file in memory. filePath: Path of an existing PDF to load. If null, creates a new PdfDocument. password: Password for encrypted PDF. Returns the documentId.")]
public AgentToolResult CreatePdfDocument([ToolParameter(Description = "Path of an existing PDF to load, or null to create a new document")] string filePath = null, [ToolParameter(Description = "Password for encrypted PDF")] string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | Optional path to an existing PDF file. If null, creates a new empty PDF document. |
| System.String | password | Optional password for encrypted PDF files. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the document ID of the created or loaded PDF document. |
ExportPdfDocument(String, String)
Exports a PDF document from memory to the file system.
Declaration
[Tool(Name = "ExportPdfDocument", Description = "Exports the PDF document to the file system.")]
public AgentToolResult ExportPdfDocument([ToolParameter(Description = "The ID of the document to export")] string documentId, [ToolParameter(Description = "The file path to export to")] string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentId | The ID of the PDF document to export. |
| System.String | filePath | The file path where the PDF should be saved. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the export file path. |
GetAllPdfDocuments()
Retrieves all PDF document IDs currently in memory.
Declaration
[Tool(Name = "GetAllPdfDocuments", Description = "Returns all document IDs for PDF document instances available in memory.")]
public AgentToolResult GetAllPdfDocuments()
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing array of all PDF document IDs. |
RemovePdfDocument(String)
Removes a specific PDF document from memory by its ID.
Declaration
[Tool(Name = "RemovePdfDocument", Description = "Removes a specific PDF document from memory by ID.")]
public AgentToolResult RemovePdfDocument([ToolParameter(Description = "The ID of the document to remove")] string documentId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentId | The ID of the document to remove. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating whether the document was removed successfully. |
SetActivePdfDocument(String)
Sets the active PDF document context by ID.
Declaration
[Tool(Name = "SetActivePdfDocument", Description = "Changes the active PDF document context by ID.")]
public AgentToolResult SetActivePdfDocument([ToolParameter(Description = "The ID of the document to set as active")] string documentId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentId | The ID of the document to set as active. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating success or failure. |