/* tslint:disable */ /* eslint-disable */ /* auto-generated by NAPI-RS */ export interface JsLiteParseConfig { /** OCR language code (e.g., "eng", "fra"). */ ocrLanguage?: string /** Whether OCR is enabled. */ ocrEnabled?: boolean /** HTTP OCR server URL. If set, uses HTTP OCR instead of Tesseract. */ ocrServerUrl?: string /** * Extra HTTP headers sent with every request to `ocrServerUrl` * (e.g. `{ Authorization: "Bearer " }`). */ ocrServerHeaders?: Record /** Path to tessdata directory for Tesseract. */ tessdataPath?: string /** Maximum number of pages to parse. */ maxPages?: number /** Specific pages to parse (e.g., "1-5,10,15-20"). */ targetPages?: string /** DPI for rendering pages (used for OCR and screenshots). */ dpi?: number /** Output format: "json", "text", or "markdown". */ outputFormat?: string /** Keep very small text that would normally be filtered out. */ preserveVerySmallText?: boolean /** Password for encrypted/protected documents. */ password?: string /** Suppress progress output. */ quiet?: boolean /** Number of concurrent OCR workers (default: CPU cores - 1). */ numWorkers?: number /** * How to surface raster images in markdown output: "off", "placeholder" * (default — emits `![](image_pN_K.png)` references with no bytes), or * "embed" (also returns each image's PNG bytes on `images`). */ imageMode?: string /** * Render hyperlink annotations as `[text](url)` in markdown output * (default true). Set false for plain anchor text. */ extractLinks?: boolean /** * Whether a systemic OCR failure aborts the whole parse (default true). * Set false to keep already-recovered native text and return partial * results when OCR is unavailable, instead of rejecting. */ ocrFailureFatal?: boolean /** * OCR request-hedging schedule (ms). Empty/unset = no hedging. Multiple * delays (e.g. `[0, 5000, 10000]`) fire duplicate requests per attempt and * take the first success — lower tail latency at the cost of extra load. */ ocrHedgeDelaysMs?: Array /** * Emit per-word sub-boxes on each text item (`TextItem.words`). Default * false. Word boxes roughly double the text-item payload, so enable only * for word-level bbox attribution. */ emitWordBoxes?: boolean /** * Restrict output to a page sub-region. Each field is the fraction of the * page cropped from that side; a text item survives only if it lies * entirely inside the remaining rectangle. Unset keeps the whole page. */ cropBox?: JsCropBox /** * Drop diagonal text (rotation >2° off the nearest right angle). Default * false. Use to exclude rotated watermarks/stamps from the output. */ skipDiagonalText?: boolean } /** * A page sub-region as the fraction cropped from each side (top-left origin, * each in `[0, 1]`). */ export interface JsCropBox { top: number right: number bottom: number left: number } /** One word's sub-box within a `JsTextItem`, in the same viewport space. */ export interface JsWordBox { text: string x: number y: number width: number height: number } export interface JsTextItem { text: string x: number y: number width: number height: number fontName?: string fontSize?: number confidence?: number /** Rotation in degrees (viewport space). Defaults to 0 when omitted. */ rotation?: number /** * Per-word sub-boxes for attribution. Empty for items with no word split * (e.g. OCR-sourced or single-token items). */ words: Array } /** * A vector-graphic primitive supplied by an external extractor. `kind` selects * the variant: `"stroke"` (uses `x1/y1/x2/y2`) or `"rect"` (uses * `x/y/width/height`). Coordinates are viewport space (top-left origin, 72 * DPI), matching the text items. `has_fill`/`has_stroke` carry the paint * intent even when no color is known, so ruled-table edge detection still * treats a colorless stroked rect as stroked. */ export interface JsGraphic { /** "stroke" or "rect". Anything else is dropped. */ kind: string x1?: number y1?: number x2?: number y2?: number x?: number y?: number width?: number height?: number /** Whether the path is filled. Drives Rect `fill` presence. */ hasFill?: boolean /** Whether the path is stroked. Drives Rect `stroke` presence. */ hasStroke?: boolean /** Fill color as ARGB hex (e.g. "ff000000"). May be absent even when filled. */ fillColor?: string /** Stroke color as ARGB hex. May be absent even when stroked. */ strokeColor?: string /** Stroke line width in points. */ lineWidth?: number } /** * A page of pre-extracted text supplied by an external extractor. Coordinates * are viewport space (top-left origin, 72 DPI). `graphics` enables ruled-table * and horizontal-rule detection; struct nodes are still unsupported on this * path, so tagged-heading detection remains unavailable until they are added. */ export interface JsPageInput { pageNumber: number pageWidth: number pageHeight: number textItems: Array graphics?: Array } export interface JsParsedPage { pageNum: number width: number height: number text: string markdown: string textItems: Array } export interface JsParseResult { pages: Array text: string images: Array } export interface JsExtractedImage { id: string page: number format: string bytes: Buffer } export interface JsScreenshotResult { pageNum: number width: number height: number imageBuffer: Buffer } export interface JsPageComplexityStats { pageNumber: number textLength: number textCoverage: number hasSubstantialImages: boolean imageBlockCount: number imageCoverage: number largestImageCoverage: number fullPageImage: boolean uncoveredVectorArea?: number isGarbled: boolean pageArea: number needsOcr: boolean reasons: Array } /** Search text items for phrase matches, returning merged items with combined bounding boxes. */ export declare function searchItems(items: Array, phrase: string, caseSensitive?: boolean | undefined | null): Array /** Main LiteParse parser class. */ export declare class LiteParse { /** * Create a new LiteParse instance with optional configuration. * Any fields not provided will use defaults. */ constructor(config?: JsLiteParseConfig | undefined | null) /** Parse a document. Accepts a file path (string) or raw PDF bytes (Buffer). */ parse(input: string | Buffer): Promise /** * Parse from pre-extracted pages, skipping PDFium text extraction. * * The caller supplies pages already populated with text items in viewport * space (top-left origin, 72 DPI). Runs only grid projection + the * configured output formatter, so it never loads PDFium. Use when an * external extractor owns text extraction (e.g. to keep its own * font-recovery pipeline). */ parsePages(pages: Array): JsParseResult /** * Determine per-page complexity. Returns one entry per parsed page with * signals (text coverage, images, garbled text, vector area) and a * `needsOcr` verdict — a cheap pre-OCR check to decide whether a document * needs advanced parsing. Accepts a file path (string) or raw PDF bytes. */ isComplex(input: string | Buffer): Promise> /** * Take screenshots of document pages. Returns PNG image buffers. * * Non-PDF files are automatically converted to PDF before rendering when * LibreOffice/ImageMagick are available. */ screenshot(input: string | Buffer, pageNumbers?: Array | undefined | null): Promise> /** Get the current configuration. */ get config(): JsLiteParseConfig }