@mcp-apps/pdf-tools-mcp-server
Version:
MCP server for interacting with PDF documents
56 lines (55 loc) • 2 kB
TypeScript
/**
* Loads a PDF document using pdf.js library
* @param filePath Path to the PDF file
* @returns Promise resolving to the loaded PDF document
*/
export declare function loadPdfWithPdfjs(filePath: string): Promise<import("pdfjs-dist/types/src/display/api").PDFDocumentProxy>;
/**
* Extracts text from the specified pages of a PDF document
* @param pdfDocument The PDF document loaded with pdf.js
* @param pageNumbers Array of page numbers to extract text from (1-based indexing)
* @returns Promise resolving to an array of objects with page number and extracted text
*/
export declare function extractTextFromPages(pdfDocument: any, pageNumbers?: number[]): Promise<{
page: number;
text: string;
}[]>;
interface PDFMetadata {
fileName: string;
fileSize: string;
pageCount: number;
author: string;
creationDate: string;
modificationDate: string;
keywords: string[];
}
interface ExtractedTable {
rows: string[][];
pageNumber: number;
}
interface ExtractedText {
page: number;
text: string;
}
export declare class PDFService {
static extractText(filePath: string, pageNumbers?: number[]): Promise<ExtractedText[]>;
/**
* Extracts tables from a PDF document
* @param filePath Path to the PDF file
* @param pageNumbers Optional specific pages to extract from
* @returns Array of extracted tables
*/
static extractTables(filePath: string, pageNumbers?: number[]): Promise<ExtractedTable[]>; /**
* Gets metadata from a PDF document
* @param filePath Path to the PDF file
* @returns The document metadata
*/
static getMetadata(filePath: string): Promise<PDFMetadata>; /**
* Analyzes a PDF document
* @param filePath Path to the PDF file
* @param analysisType Type of analysis to perform
* @returns Analysis results
*/
static analyzeDocument(filePath: string, analysisType: 'structure' | 'content' | 'images' | 'classification'): Promise<any>;
}
export {};