import { convertPDFToHTMLWithLiteParse, LiteParseHTMLOptions } from './liteparse-to-html'; import { convertPDFToHTMLWithLiteParseWasm } from './liteparse-wasm-to-html'; /** * Which parsing engine {@link convertPDFToHTML} runs. * - `"ts-block-algorithm"` (default) — the pure-TS pipeline in this file: groups * pdfjs text spans into lines/blocks and renders headings/lists/code blocks. * Works in Node.js, Cloudflare Workers, and browsers. * - `"liteparse"` — delegates to [LiteParse](https://github.com/run-llama/liteparse), * a native/OCR-capable parser. Node.js only (ships a napi addon), and requires * the optional `@llamaindex/liteparse` dependency to be installed. * - `"liteparse-wasm"` — delegates to LiteParse's WebAssembly build. Runs * anywhere WASM does — browsers, Cloudflare Workers, and Node.js — and * requires the optional `@llamaindex/liteparse-wasm` dependency to be * installed. OCR requires passing an `ocrEngine` callback (e.g. tesseract-js). */ export type ParseMethod = "ts-block-algorithm" | "liteparse" | "liteparse-wasm"; /** * Extracts formatted text from PDF with parsing of linebreaks , * page headers, footnotes, and section headings. Supports fonts, links, bold, * italics, lists, headings, headers, footnotes, and Table of Contents, * Quotes, and Code Blocks, . Removes repeated headers, links footnote anchors to the footnote, * and preserves number of the PDF page with invisible I element. * * This function uses [pdfjs-serverless](https://github.com/johannschopplich/pdfjs-serverless) * to work in more environments than PDF.js-based tools: * Cloudflare workers, serverless, node.js, and front-end only. * @param {string} pdfURLOrBuffer - URL to a PDF file or buffer from fs.readFile * @param {Object} [options] * @param {boolean} options.addPageNumbers default=false - Adds # to end of each page * @param {boolean} options.removePageHeaders default=true - Removes repeated headers found on each page * @param {ParseMethod} options.method default="ts-block-algorithm" - Parsing engine to use; * `"liteparse"` delegates to LiteParse (Node.js only, see {@link ParseMethod}) * @returns {string|Object} HTML formatted text * @category Extract * @author [vtempest (2025)](https://github.com/vtempest), * [pdf-to-markdown (2017)](https://github.com/jzillmann/pdf-to-markdown/tree/master), * [pdf.js (2012-)](https://github.com/mozilla/pdf.js/releases), */ export declare function convertPDFToHTML(pdfURLOrBuffer: any, options?: { addPageNumbers?: boolean; addCitation?: boolean; method?: ParseMethod; } & Pick): Promise<{ error: any; author?: undefined; title?: undefined; html?: undefined; format?: undefined; } | { author: string; title: string; html: any; format: string; error?: undefined; } | { author: any; title: any; html: string; format: string; }>; export { convertPDFToHTMLWithLiteParse }; export type { LiteParseHTMLOptions } from './liteparse-to-html'; export { convertPDFToHTMLWithLiteParseWasm }; export type { LiteParseWasmHTMLOptions } from './liteparse-wasm-to-html'; export { detectPdfNeedsOcr } from './detect-needs-ocr'; export type { DetectPdfNeedsOcrOptions, PdfOcrAssessment, } from './detect-needs-ocr';