Comparing version
@@ -38,2 +38,10 @@ export type InitOptions = { password?: string; debug?: boolean }; | ||
export type RuleAccumulator = (item: Item) => boolean | void; | ||
export type RuleHandler<T = any> = (value: T) => void; | ||
export interface TableResult { | ||
matrix: string[][]; | ||
items: Item[]; | ||
} | ||
export class TableParser { | ||
@@ -51,1 +59,25 @@ private rows: { [key: string]: Item[] }; | ||
} | ||
export class Rule { | ||
static on(regexp: RegExp): Rule; | ||
static after(regexp: RegExp): Rule; | ||
static makeItemProcessor(rules: Rule[]): (item: DataEntry) => void; | ||
static addAccumulator(methodName: string, methodBuilder: Function): void; | ||
constructor(regexp: RegExp); | ||
// Accumulator methods | ||
extractRegexpValues(): Rule; | ||
parseNextItemValue(): Rule; | ||
accumulateAfterHeading(): Rule; | ||
accumulateFromSameX(): Rule; | ||
parseColumns(...args: any[]): Rule; | ||
parseTable(columnCount: number): Rule & { | ||
then(handler: (result: TableResult) => void): Rule; | ||
}; | ||
then<T>(handler: RuleHandler<T>): Rule; | ||
private test(item: Item): RuleAccumulator | undefined; | ||
private whenDone(callback: () => void): void; | ||
} |
{ | ||
"name": "pdfreader", | ||
"type": "module", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Read text and parse tables from PDF files. Supports tabular data with automatic column detection, and rule-based parsing.", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.cjs", |
59213
1.56%1454
1.75%