Skip to content

A fast, helpful, and open-source document parser

Merge branch 'main' into feat/expose-ocr-confidence

Logan199dcaba6d4a
diff --cc src/core/types.ts
index e2ce0df,e9ea6cc..a32593b
--- a/src/core/types.ts
+++ b/src/core/types.ts
@@@ -280,6 -286,40 +288,42 @@@ export interface ParsedPage
boundingBoxes?: BoundingBox[];
}
+ /**
+ * A text element from the JSON output with position, size, and font metadata.
+ */
+ export interface JsonTextItem {
+ /** The text content of this item. */
+ text: string;
+ /** X coordinate of the top-left corner, in PDF points. */
+ x: number;
+ /** Y coordinate of the top-left corner, in PDF points. */
+ y: number;
+ /** Width of the text item in PDF points. */
+ width: number;
+ /** Height of the text item in PDF points. */
+ height: number;
+ /** Font name. */
+ fontName?: string;
+ /** Font size in PDF points. */
+ fontSize?: number;
++ /** The OCR confidence (null if OCR wasn't used) */
++ confidence?: number;
+ }
+
+ /**
+ * Options for {@link searchItems}.
+ */
+ export interface SearchItemsOptions {
+ /** Find text items containing this phrase. Matches can span multiple adjacent items. */
+ phrase: string;
+ /**
+ * Whether the search should be case-sensitive.
+ *
+ * @defaultValue `false`
+ */
+ caseSensitive?: boolean;
+ }
+
/**
* Structured JSON representation of parsed document data.
* Returned when {@link LiteParseConfig.outputFormat} is `"json"`.