PdfContentExtractionAgentTools Class
Provides AI agent tools for extracting content from PDF documents. Handles text, image, and table extraction operations.
Inheritance
Inherited Members
Namespace: Syncfusion.AI.AgentTools.PDF
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class PdfContentExtractionAgentTools : AgentToolBase<PdfDocumentBase>
Constructors
PdfContentExtractionAgentTools(DocumentStorageManager)
Initializes a new instance of the PdfContentExtractionAgentTools class (Mode 2 � DocumentStorage).
Declaration
public PdfContentExtractionAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
PdfContentExtractionAgentTools(PdfDocumentManager)
Initializes a new instance of the PdfContentExtractionAgentTools class (Mode 1 � InMemory).
Declaration
public PdfContentExtractionAgentTools(PdfDocumentManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentManager | manager | The PDF document manager. |
Methods
ExtractImages(String, Int32, Int32, String)
Extracts images from a PDF document using a page range or the entire document. Saves the extracted images to the specified output folder.
Declaration
[Tool(Name = "ExtractImages", Description = "Extracts images from a PDF document using a page range or the entire document. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ExtractImages([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "Starting page index (0-based). Use -1 to extract all pages.")] int startPageIndex = -1, [ToolParameter(Description = "Ending page index (0-based). Use -1 to extract all pages.")] int endPageIndex = -1, [ToolParameter(Description = "Optional output folder path.")] string outputPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.Int32 | startPageIndex | Starting page index (0-based). Use -1 to extract all pages. |
| System.Int32 | endPageIndex | Ending page index (0-based). Use -1 to extract all pages. |
| System.String | outputPath | Optional output folder path. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the image count and output folder path. |
Remarks
Supports:
ExtractText(String, Int32, Int32)
Extracts text content from a PDF document, either from a specific range of pages or from the entire file.
Declaration
[Tool(Name = "ExtractText", Description = "Extracts text content from a PDF document, either from a specific range of pages or from the entire file. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult ExtractText([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "Starting page index (0-based), -1 for all pages")] int startPageIndex = -1, [ToolParameter(Description = "Ending page index (0-based), -1 for all pages")] int endPageIndex = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.Int32 | startPageIndex | Starting page index (0-based), -1 for all pages. |
| System.Int32 | endPageIndex | Ending page index (0-based), -1 for all pages. |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the extracted text and page count. |
FindTextInPdf(String, String[])
Declaration
[Tool(Name = "FindTextInPdf", Description = "Searches a PDF document for matching array of text and returns all occurrences grouped by page. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult FindTextInPdf([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The array of text to be searched")] string[] texts)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | |
| System.String[] | texts |
Returns
| Type |
|---|
| AgentToolResult |
GetPdfDocumentPageCount(String)
Retrieves the number of pages in a PDF document identified by the specified document ID or file path.
Declaration
[Tool(Name = "GetPdfDocumentPageCount", Description = "Returns the number of pages in the specified PDF document. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult GetPdfDocumentPageCount([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The document ID (InMemory mode) or input file path (DocumentStorage mode). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | An AgentToolResult containing the page count of the specified PDF document if successful; otherwise, a failure result with an error message. |
GetPdfDocumentPageSize(String, Int32)
Declaration
[Tool(Name = "GetPdfDocumentPageSize", Description = "Gets the width and height of a specific page in a PDF document. Works for both newly created and loaded documents without reloading.This is required when placing elements like signatures, stamps, or annotations at specific positions such as bottom-right, bottom-left, top-right, top-left.")]
public AgentToolResult GetPdfDocumentPageSize([ToolParameter(Description = "The document ID (InMemory mode) or input file path.")] string documentIdOrFilePath, [ToolParameter(Description = "Page number (1-based index).")] int pageNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | |
| System.Int32 | pageNumber |
Returns
| Type |
|---|
| AgentToolResult |