/* auto-generated by NAPI-RS */ /* eslint-disable */ /** * Lightweight PDF classification — returns type, page count, and OCR pages. * Faster than detectPdf as it skips building the full PdfResult. * Pages in pagesNeedingOcr are 0-indexed. */ export declare function classifyPdf(buffer: Buffer): PdfClassification /** Fast detection only — no text extraction or markdown. */ export declare function detectPdf(buffer: Buffer): PdfResult /** * Extract formatted markdown for specific pages of a PDF, with layout * classification metadata. * * Returns per-page markdown and classification data (tables, columns, * OCR needs) from a single parse. Font statistics are computed from the * full document so header detection is consistent across pages. */ export declare function extractPagesMarkdown(buffer: Buffer, pages: Array): PagesExtractionResult /** * Extract markdown tables within bounding-box regions from a PDF. * * Like `extractTextInRegions` but runs table detection on items within each * region and returns markdown pipe-tables instead of flat text. * * When table structure is detected, `text` contains a markdown pipe-table and * `needsOcr` is `false`. When no table is found, `text` is empty and * `needsOcr` is `true` so the caller can fall back to GPU OCR. * * Coordinates are PDF points with top-left origin. */ export declare function extractTablesInRegions(buffer: Buffer, pageRegions: Array): Array /** Extract plain text from a PDF Buffer. */ export declare function extractText(buffer: Buffer): string /** * Extract text within bounding-box regions from a PDF. * * For hybrid OCR: layout model detects regions in rendered images, * this extracts PDF text within those regions — skipping GPU OCR * for text-based pages. * * Each region result includes `needsOcr` — set when the extracted text * is unreliable (empty, GID-encoded fonts, garbage, encoding issues). * * Coordinates are PDF points with top-left origin. */ export declare function extractTextInRegions(buffer: Buffer, pageRegions: Array): Array /** Extract text with position information from a PDF Buffer. */ export declare function extractTextWithPositions(buffer: Buffer, pages?: Array | undefined | null): Array /** Type of a positioned text item. */ export declare const enum ItemType { Text = 'Text', Image = 'Image', Link = 'Link', FormField = 'FormField' } /** Per-page markdown extraction result. */ export interface PageMarkdownResult { /** 0-indexed page number. */ page: number /** Formatted markdown for this page. */ markdown: string /** `true` when text on this page is unreliable. */ needsOcr: boolean } /** A page's regions for text extraction: (page_index_0based, bboxes). */ export interface PageRegions { page: number /** Each bbox is [x1, y1, x2, y2] in PDF points, top-left origin. */ regions: Array> } /** Extracted text for one page's regions. */ export interface PageRegionTexts { page: number regions: Array } /** Combined per-page markdown extraction and layout classification result. */ export interface PagesExtractionResult { /** Per-page markdown results. */ pages: Array /** 1-indexed pages where tables were detected. */ pagesWithTables: Array /** 1-indexed pages where multi-column layout was detected. */ pagesWithColumns: Array /** 1-indexed pages that need OCR (scanned/image-based). */ pagesNeedingOcr: Array /** True if any page has tables or columns. */ isComplex: boolean } /** Lightweight PDF classification result. */ export interface PdfClassification { pdfType: PdfType pageCount: number /** 0-indexed page numbers that need OCR. */ pagesNeedingOcr: Array confidence: number } /** Full PDF processing result with markdown and metadata. */ export interface PdfResult { pdfType: PdfType markdown?: string pageCount: number processingTimeMs: number /** 1-indexed page numbers that need OCR. */ pagesNeedingOcr: Array title?: string confidence: number isComplexLayout: boolean pagesWithTables: Array pagesWithColumns: Array hasEncodingIssues: boolean } /** PDF document type classification. */ export declare const enum PdfType { TextBased = 'TextBased', Scanned = 'Scanned', ImageBased = 'ImageBased', Mixed = 'Mixed' } /** Process a PDF from a Buffer: detect type, extract text, and convert to Markdown. */ export declare function processPdf(buffer: Buffer, pages?: Array | undefined | null): PdfResult /** Extracted text for a single region. */ export interface RegionText { text: string /** `true` when the text should not be trusted (empty, GID fonts, garbage, encoding issues). */ needsOcr: boolean } /** A positioned text item extracted from a PDF. */ export interface TextItem { text: string x: number y: number width: number height: number font: string fontSize: number page: number isBold: boolean isItalic: boolean itemType: ItemType /** URL for link items, `None` for other types. */ linkUrl?: string }