pdf-toolmd
Version:
Convert PDF to Markdown using Node.js
34 lines (33 loc) • 849 B
TypeScript
interface ParseOptions {
apiKey?: string;
baseUrl?: string;
model?: string;
openAiApicompatible?: boolean;
outputDir?: string;
prompt?: string;
textPrompt?: string;
verbose?: boolean;
scale?: number;
concurrency?: number;
onProgress?: (progress: ProgressInfo) => void;
}
interface ProgressInfo {
current: number;
total: number;
taskStatus: 'starting' | 'running' | 'finished';
}
interface ParseResult {
content: string;
mdFilePath: string;
}
/**
* 将PDF文件解析为Markdown
*/
export declare const parsePdf: (pdfPath: string, options?: ParseOptions) => Promise<ParseResult>;
/**
* 获取PDF文档的页数
* @param pdfData PDF文件数据或路径
* @returns PDF文档的总页数
*/
export declare const getPageNum: (pdfData: Buffer | string) => Promise<number>;
export {};