MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / extractPdfText

Function extractPdfText

frontend/lib/pdf-utils.ts:47–54  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

45 * This is used as a fallback when remote API fails.
46 */
47export async function extractPdfText(file: File): Promise<string> {
48 console.log("[PDF] Using client-side extraction with unpdf...")
49 const buffer = await file.arrayBuffer()
50 const pdf = await getDocumentProxy(new Uint8Array(buffer))
51 const { text } = await extractText(pdf, { mergePages: true })
52 console.log("[PDF] Client-side extraction completed, text length:", (text as string).length)
53 return text as string
54}
55
56/**
57 * Check if a file is a PDF

Callers 4

handleFileUploadFunction · 0.90
handleFileUploadFunction · 0.90
handleFileChangeFunction · 0.90
handleFileUploadFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected