pdf-oxide-fips 0.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +176 -0
- package/LICENSE-MIT +25 -0
- package/README.md +218 -0
- package/lib/builders/annotation-builder.d.ts +198 -0
- package/lib/builders/annotation-builder.js +317 -0
- package/lib/builders/conversion-options-builder.d.ts +106 -0
- package/lib/builders/conversion-options-builder.js +214 -0
- package/lib/builders/document-builder.d.ts +381 -0
- package/lib/builders/document-builder.js +770 -0
- package/lib/builders/index.d.ts +13 -0
- package/lib/builders/index.js +13 -0
- package/lib/builders/metadata-builder.d.ts +201 -0
- package/lib/builders/metadata-builder.js +285 -0
- package/lib/builders/pdf-builder.d.ts +216 -0
- package/lib/builders/pdf-builder.js +350 -0
- package/lib/builders/search-options-builder.d.ts +73 -0
- package/lib/builders/search-options-builder.js +129 -0
- package/lib/builders/streaming-table.d.ts +64 -0
- package/lib/builders/streaming-table.js +140 -0
- package/lib/document-editor-manager.d.ts +139 -0
- package/lib/document-editor-manager.js +256 -0
- package/lib/document-editor.d.ts +124 -0
- package/lib/document-editor.js +318 -0
- package/lib/errors.d.ts +382 -0
- package/lib/errors.js +1115 -0
- package/lib/form-field-manager.d.ts +299 -0
- package/lib/form-field-manager.js +568 -0
- package/lib/hybrid-ml-manager.d.ts +142 -0
- package/lib/hybrid-ml-manager.js +208 -0
- package/lib/index.d.ts +205 -0
- package/lib/index.js +693 -0
- package/lib/managers/accessibility-manager.d.ts +148 -0
- package/lib/managers/accessibility-manager.js +234 -0
- package/lib/managers/annotation-manager.d.ts +219 -0
- package/lib/managers/annotation-manager.js +359 -0
- package/lib/managers/barcode-manager.d.ts +82 -0
- package/lib/managers/barcode-manager.js +263 -0
- package/lib/managers/batch-manager.d.ts +185 -0
- package/lib/managers/batch-manager.js +385 -0
- package/lib/managers/cache-manager.d.ts +181 -0
- package/lib/managers/cache-manager.js +384 -0
- package/lib/managers/compliance-manager.d.ts +103 -0
- package/lib/managers/compliance-manager.js +453 -0
- package/lib/managers/content-manager.d.ts +120 -0
- package/lib/managers/content-manager.js +294 -0
- package/lib/managers/document-utility-manager.d.ts +369 -0
- package/lib/managers/document-utility-manager.js +730 -0
- package/lib/managers/dom-pdf-creator.d.ts +104 -0
- package/lib/managers/dom-pdf-creator.js +299 -0
- package/lib/managers/editing-manager.d.ts +248 -0
- package/lib/managers/editing-manager.js +387 -0
- package/lib/managers/enterprise-manager.d.ts +192 -0
- package/lib/managers/enterprise-manager.js +307 -0
- package/lib/managers/extended-managers.d.ts +122 -0
- package/lib/managers/extended-managers.js +664 -0
- package/lib/managers/extraction-manager.d.ts +246 -0
- package/lib/managers/extraction-manager.js +482 -0
- package/lib/managers/final-utilities.d.ts +127 -0
- package/lib/managers/final-utilities.js +657 -0
- package/lib/managers/hybrid-ml-advanced.d.ts +136 -0
- package/lib/managers/hybrid-ml-advanced.js +722 -0
- package/lib/managers/index.d.ts +64 -0
- package/lib/managers/index.js +69 -0
- package/lib/managers/layer-manager.d.ts +203 -0
- package/lib/managers/layer-manager.js +401 -0
- package/lib/managers/metadata-manager.d.ts +148 -0
- package/lib/managers/metadata-manager.js +280 -0
- package/lib/managers/ocr-manager.d.ts +194 -0
- package/lib/managers/ocr-manager.js +582 -0
- package/lib/managers/optimization-manager.d.ts +102 -0
- package/lib/managers/optimization-manager.js +213 -0
- package/lib/managers/outline-manager.d.ts +101 -0
- package/lib/managers/outline-manager.js +169 -0
- package/lib/managers/page-manager.d.ts +142 -0
- package/lib/managers/page-manager.js +235 -0
- package/lib/managers/pattern-detection.d.ts +169 -0
- package/lib/managers/pattern-detection.js +322 -0
- package/lib/managers/rendering-manager.d.ts +353 -0
- package/lib/managers/rendering-manager.js +679 -0
- package/lib/managers/search-manager.d.ts +235 -0
- package/lib/managers/search-manager.js +329 -0
- package/lib/managers/security-manager.d.ts +161 -0
- package/lib/managers/security-manager.js +292 -0
- package/lib/managers/signature-manager.d.ts +738 -0
- package/lib/managers/signature-manager.js +1509 -0
- package/lib/managers/streams.d.ts +262 -0
- package/lib/managers/streams.js +477 -0
- package/lib/managers/xfa-manager.d.ts +227 -0
- package/lib/managers/xfa-manager.js +539 -0
- package/lib/native-loader.d.ts +7 -0
- package/lib/native-loader.js +62 -0
- package/lib/native.d.ts +16 -0
- package/lib/native.js +69 -0
- package/lib/pdf-creator-manager.d.ts +200 -0
- package/lib/pdf-creator-manager.js +381 -0
- package/lib/properties.d.ts +79 -0
- package/lib/properties.js +454 -0
- package/lib/result-accessors-manager.d.ts +346 -0
- package/lib/result-accessors-manager.js +706 -0
- package/lib/thumbnail-manager.d.ts +121 -0
- package/lib/thumbnail-manager.js +205 -0
- package/lib/timestamp.d.ts +54 -0
- package/lib/timestamp.js +115 -0
- package/lib/tsa-client.d.ts +44 -0
- package/lib/tsa-client.js +67 -0
- package/lib/types/common.d.ts +189 -0
- package/lib/types/common.js +17 -0
- package/lib/types/document-types.d.ts +352 -0
- package/lib/types/document-types.js +82 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.js +5 -0
- package/lib/types/manager-types.d.ts +179 -0
- package/lib/types/manager-types.js +100 -0
- package/lib/types/native-bindings.d.ts +439 -0
- package/lib/types/native-bindings.js +7 -0
- package/lib/workers/index.d.ts +6 -0
- package/lib/workers/index.js +5 -0
- package/lib/workers/pool.d.ts +64 -0
- package/lib/workers/pool.js +192 -0
- package/lib/workers/worker.d.ts +5 -0
- package/lib/workers/worker.js +99 -0
- package/package.json +79 -0
- package/prebuilds/darwin-arm64/pdf_oxide.node +0 -0
- package/prebuilds/darwin-x64/pdf_oxide.node +0 -0
- package/prebuilds/linux-arm64/pdf_oxide.node +0 -0
- package/prebuilds/linux-x64/pdf_oxide.node +0 -0
- package/prebuilds/win32-x64/pdf_oxide.node +0 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manager for PDF page-level operations
|
|
3
|
+
*
|
|
4
|
+
* Provides methods to query page count, dimensions, and validate indices.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { PageManager } from 'pdf_oxide';
|
|
9
|
+
*
|
|
10
|
+
* const doc = PdfDocument.open('document.pdf');
|
|
11
|
+
* const pageManager = new PageManager(doc);
|
|
12
|
+
*
|
|
13
|
+
* console.log(`Document has ${pageManager.getPageCount()} pages`);
|
|
14
|
+
*
|
|
15
|
+
* if (pageManager.isValidPageIndex(5)) {
|
|
16
|
+
* const info = pageManager.getPageInfo(5);
|
|
17
|
+
* console.log(`Page 5: ${info.width} x ${info.height} points`);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class PageManager {
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new PageManager for the given document
|
|
24
|
+
* @param document - The PDF document
|
|
25
|
+
* @throws Error if document is null or undefined
|
|
26
|
+
*/
|
|
27
|
+
constructor(document) {
|
|
28
|
+
if (!document) {
|
|
29
|
+
throw new Error('Document is required');
|
|
30
|
+
}
|
|
31
|
+
this._document = document;
|
|
32
|
+
this._cache = new Map();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Clears the page cache
|
|
36
|
+
*/
|
|
37
|
+
clearCache() {
|
|
38
|
+
this._cache.clear();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the total number of pages in the document
|
|
42
|
+
* @returns Number of pages
|
|
43
|
+
*/
|
|
44
|
+
getPageCount() {
|
|
45
|
+
const cacheKey = 'page:count';
|
|
46
|
+
if (this._cache.has(cacheKey)) {
|
|
47
|
+
return this._cache.get(cacheKey);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const count = this._document.pageCount || 0;
|
|
51
|
+
this._cache.set(cacheKey, count);
|
|
52
|
+
return count;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Checks if a page index is valid for this document
|
|
60
|
+
* @param pageIndex - Page index to validate (0-based)
|
|
61
|
+
* @returns True if the page index is valid
|
|
62
|
+
*/
|
|
63
|
+
isValidPageIndex(pageIndex) {
|
|
64
|
+
if (pageIndex < 0) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return pageIndex < this.getPageCount();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets information about a specific page
|
|
71
|
+
* @param pageIndex - Page index (0-based)
|
|
72
|
+
* @returns PageInfo object with page dimensions
|
|
73
|
+
* @throws Error if page index is invalid
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const info = manager.getPageInfo(0);
|
|
78
|
+
* console.log(`Page 0: ${info.width} x ${info.height} points`);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getPageInfo(pageIndex) {
|
|
82
|
+
const cacheKey = `page:info:${pageIndex}`;
|
|
83
|
+
if (this._cache.has(cacheKey)) {
|
|
84
|
+
return this._cache.get(cacheKey);
|
|
85
|
+
}
|
|
86
|
+
if (!this.isValidPageIndex(pageIndex)) {
|
|
87
|
+
throw new Error(`Invalid page index: ${pageIndex}`);
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const page = this._document.getPage(pageIndex);
|
|
91
|
+
const info = {
|
|
92
|
+
index: pageIndex,
|
|
93
|
+
width: page?.width || 0,
|
|
94
|
+
height: page?.height || 0,
|
|
95
|
+
};
|
|
96
|
+
this._cache.set(cacheKey, info);
|
|
97
|
+
return info;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
index: pageIndex,
|
|
102
|
+
width: 0,
|
|
103
|
+
height: 0,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Gets information about all pages in the document
|
|
109
|
+
* @returns Array of PageInfo objects
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const pages = manager.getAllPageInfo();
|
|
114
|
+
* pages.forEach(page => {
|
|
115
|
+
* console.log(`Page ${page.index}: ${page.width} x ${page.height}`);
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
getAllPageInfo() {
|
|
120
|
+
const cacheKey = 'page:info:all';
|
|
121
|
+
if (this._cache.has(cacheKey)) {
|
|
122
|
+
return this._cache.get(cacheKey);
|
|
123
|
+
}
|
|
124
|
+
const count = this.getPageCount();
|
|
125
|
+
const pages = [];
|
|
126
|
+
for (let i = 0; i < count; i++) {
|
|
127
|
+
pages.push(this.getPageInfo(i));
|
|
128
|
+
}
|
|
129
|
+
this._cache.set(cacheKey, pages);
|
|
130
|
+
return pages;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Checks if the document has no pages
|
|
134
|
+
* @returns True if the document has no pages
|
|
135
|
+
*/
|
|
136
|
+
isEmpty() {
|
|
137
|
+
return this.getPageCount() === 0;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Checks if the document has more than one page
|
|
141
|
+
* @returns True if document has multiple pages
|
|
142
|
+
*/
|
|
143
|
+
hasMultiplePages() {
|
|
144
|
+
return this.getPageCount() > 1;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Gets the valid page range
|
|
148
|
+
* @returns Object with firstPage and lastPage indices
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const range = manager.getPageRange();
|
|
153
|
+
* console.log(`Page range: ${range.firstPage} to ${range.lastPage}`);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
getPageRange() {
|
|
157
|
+
const count = this.getPageCount();
|
|
158
|
+
if (count === 0) {
|
|
159
|
+
return { firstPage: 0, lastPage: -1 };
|
|
160
|
+
}
|
|
161
|
+
return { firstPage: 0, lastPage: count - 1 };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Gets page dimension statistics
|
|
165
|
+
* @returns Statistics about page dimensions
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const stats = manager.getPageStatistics();
|
|
170
|
+
* console.log(`Average width: ${stats.averageWidth}`);
|
|
171
|
+
* console.log(`Pages vary in size: ${stats.hasVariableSizes}`);
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
getPageStatistics() {
|
|
175
|
+
const pages = this.getAllPageInfo();
|
|
176
|
+
if (pages.length === 0) {
|
|
177
|
+
return {
|
|
178
|
+
count: 0,
|
|
179
|
+
minWidth: 0,
|
|
180
|
+
maxWidth: 0,
|
|
181
|
+
minHeight: 0,
|
|
182
|
+
maxHeight: 0,
|
|
183
|
+
averageWidth: 0,
|
|
184
|
+
averageHeight: 0,
|
|
185
|
+
hasVariableSizes: false,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const widths = pages.map((p) => p.width);
|
|
189
|
+
const heights = pages.map((p) => p.height);
|
|
190
|
+
const minWidth = Math.min(...widths);
|
|
191
|
+
const maxWidth = Math.max(...widths);
|
|
192
|
+
const minHeight = Math.min(...heights);
|
|
193
|
+
const maxHeight = Math.max(...heights);
|
|
194
|
+
const averageWidth = widths.reduce((a, b) => a + b, 0) / widths.length;
|
|
195
|
+
const averageHeight = heights.reduce((a, b) => a + b, 0) / heights.length;
|
|
196
|
+
return {
|
|
197
|
+
count: pages.length,
|
|
198
|
+
minWidth,
|
|
199
|
+
maxWidth,
|
|
200
|
+
minHeight,
|
|
201
|
+
maxHeight,
|
|
202
|
+
averageWidth,
|
|
203
|
+
averageHeight,
|
|
204
|
+
hasVariableSizes: minWidth !== maxWidth || minHeight !== maxHeight,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Gets pages within a specific size range
|
|
209
|
+
* @param minWidth - Minimum width
|
|
210
|
+
* @param maxWidth - Maximum width
|
|
211
|
+
* @param minHeight - Minimum height
|
|
212
|
+
* @param maxHeight - Maximum height
|
|
213
|
+
* @returns Matching PageInfo objects
|
|
214
|
+
*/
|
|
215
|
+
getPagesInSizeRange(minWidth, maxWidth, minHeight, maxHeight) {
|
|
216
|
+
const pages = this.getAllPageInfo();
|
|
217
|
+
return pages.filter((p) => p.width >= minWidth && p.width <= maxWidth && p.height >= minHeight && p.height <= maxHeight);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Gets landscape pages
|
|
221
|
+
* @returns Array of landscape PageInfo objects
|
|
222
|
+
*/
|
|
223
|
+
getLandscapePages() {
|
|
224
|
+
const pages = this.getAllPageInfo();
|
|
225
|
+
return pages.filter((p) => p.width > p.height);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Gets portrait pages
|
|
229
|
+
* @returns Array of portrait PageInfo objects
|
|
230
|
+
*/
|
|
231
|
+
getPortraitPages() {
|
|
232
|
+
const pages = this.getAllPageInfo();
|
|
233
|
+
return pages.filter((p) => p.height > p.width);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Detection Manager - TypeScript/Node.js Implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides ML-powered pattern detection for PDF analysis:
|
|
5
|
+
* - Table detection and extraction
|
|
6
|
+
* - Column detection and analysis
|
|
7
|
+
* - Barcode detection and decoding
|
|
8
|
+
* - Form field detection
|
|
9
|
+
* - Layout pattern recognition
|
|
10
|
+
*/
|
|
11
|
+
import type { PdfDocument } from '../types/document-types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Represents a detected table region on a page.
|
|
14
|
+
*/
|
|
15
|
+
export interface TableRegion {
|
|
16
|
+
readonly x: number;
|
|
17
|
+
readonly y: number;
|
|
18
|
+
readonly width: number;
|
|
19
|
+
readonly height: number;
|
|
20
|
+
readonly rowCount?: number;
|
|
21
|
+
readonly columnCount?: number;
|
|
22
|
+
readonly confidence?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents a detected column region on a page.
|
|
26
|
+
*/
|
|
27
|
+
export interface ColumnRegion {
|
|
28
|
+
readonly x: number;
|
|
29
|
+
readonly y: number;
|
|
30
|
+
readonly width: number;
|
|
31
|
+
readonly height: number;
|
|
32
|
+
readonly columnIndex?: number;
|
|
33
|
+
readonly confidence?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a detected barcode.
|
|
37
|
+
*/
|
|
38
|
+
export interface BarcodeRegion {
|
|
39
|
+
readonly x: number;
|
|
40
|
+
readonly y: number;
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
readonly format: string;
|
|
44
|
+
readonly value: string;
|
|
45
|
+
readonly confidence?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents a detected form field.
|
|
49
|
+
*/
|
|
50
|
+
export interface FormFieldRegion {
|
|
51
|
+
readonly x: number;
|
|
52
|
+
readonly y: number;
|
|
53
|
+
readonly width: number;
|
|
54
|
+
readonly height: number;
|
|
55
|
+
readonly fieldType: string;
|
|
56
|
+
readonly fieldName?: string;
|
|
57
|
+
readonly confidence?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Layout pattern type enumeration.
|
|
61
|
+
*/
|
|
62
|
+
export declare enum LayoutPatternType {
|
|
63
|
+
SINGLE_COLUMN = "single_column",
|
|
64
|
+
MULTI_COLUMN = "multi_column",
|
|
65
|
+
TABLE_BASED = "table_based",
|
|
66
|
+
FORM_BASED = "form_based",
|
|
67
|
+
MAGAZINE_STYLE = "magazine_style",
|
|
68
|
+
COMPLEX_MIXED = "complex_mixed"
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Detected layout pattern.
|
|
72
|
+
*/
|
|
73
|
+
export interface LayoutPattern {
|
|
74
|
+
readonly pageIndex: number;
|
|
75
|
+
readonly patternType: LayoutPatternType;
|
|
76
|
+
readonly confidence: number;
|
|
77
|
+
readonly regions: Array<TableRegion | ColumnRegion>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Pattern Detection Manager for TypeScript/Node.js
|
|
81
|
+
*
|
|
82
|
+
* Provides detection and analysis of common patterns in PDF documents.
|
|
83
|
+
*/
|
|
84
|
+
export declare class PatternDetectionManager {
|
|
85
|
+
private readonly document;
|
|
86
|
+
private readonly cache;
|
|
87
|
+
/**
|
|
88
|
+
* Create a new PatternDetectionManager.
|
|
89
|
+
*/
|
|
90
|
+
constructor(document: PdfDocument);
|
|
91
|
+
/**
|
|
92
|
+
* Detect tables on a specific page.
|
|
93
|
+
*
|
|
94
|
+
* @param pageIndex - Index of the page to analyze
|
|
95
|
+
* @returns Array of detected table regions
|
|
96
|
+
*/
|
|
97
|
+
detectTables(pageIndex: number): Promise<TableRegion[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Detect columns on a specific page.
|
|
100
|
+
*
|
|
101
|
+
* @param pageIndex - Index of the page to analyze
|
|
102
|
+
* @returns Array of detected column regions
|
|
103
|
+
*/
|
|
104
|
+
detectColumns(pageIndex: number): Promise<ColumnRegion[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Detect barcodes on a specific page.
|
|
107
|
+
*
|
|
108
|
+
* @param pageIndex - Index of the page to analyze
|
|
109
|
+
* @returns Array of detected barcodes
|
|
110
|
+
*/
|
|
111
|
+
detectBarcodes(pageIndex: number): Promise<BarcodeRegion[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Detect form fields on a specific page.
|
|
114
|
+
*
|
|
115
|
+
* @param pageIndex - Index of the page to analyze
|
|
116
|
+
* @returns Array of detected form fields
|
|
117
|
+
*/
|
|
118
|
+
detectFormFields(pageIndex: number): Promise<FormFieldRegion[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Analyze layout pattern of a page.
|
|
121
|
+
*
|
|
122
|
+
* @param pageIndex - Index of the page to analyze
|
|
123
|
+
* @returns Detected layout pattern
|
|
124
|
+
*/
|
|
125
|
+
analyzeLayoutPattern(pageIndex: number): Promise<LayoutPattern>;
|
|
126
|
+
/**
|
|
127
|
+
* Detect all patterns on a specific page.
|
|
128
|
+
*
|
|
129
|
+
* @param pageIndex - Index of the page to analyze
|
|
130
|
+
* @returns Object with all detected patterns
|
|
131
|
+
*/
|
|
132
|
+
detectAllPatterns(pageIndex: number): Promise<{
|
|
133
|
+
tables: TableRegion[];
|
|
134
|
+
columns: ColumnRegion[];
|
|
135
|
+
barcodes: BarcodeRegion[];
|
|
136
|
+
formFields: FormFieldRegion[];
|
|
137
|
+
layout: LayoutPattern;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Analyze patterns across entire document.
|
|
141
|
+
*
|
|
142
|
+
* @returns Array of layout patterns for each page
|
|
143
|
+
*/
|
|
144
|
+
analyzeDocumentPatterns(): Promise<LayoutPattern[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Find pages with specific pattern type.
|
|
147
|
+
*
|
|
148
|
+
* @param patternType - Pattern type to find
|
|
149
|
+
* @returns Array of page indices with the specified pattern
|
|
150
|
+
*/
|
|
151
|
+
findPagesWithPattern(patternType: LayoutPatternType): Promise<number[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Get pattern statistics for the document.
|
|
154
|
+
*
|
|
155
|
+
* @returns Statistics about detected patterns
|
|
156
|
+
*/
|
|
157
|
+
getPatternStatistics(): Promise<{
|
|
158
|
+
totalPages: number;
|
|
159
|
+
pagesWithTables: number;
|
|
160
|
+
pagesWithColumns: number;
|
|
161
|
+
avgTablesPerPage: number;
|
|
162
|
+
avgColumnsPerPage: number;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* Clear the internal cache.
|
|
166
|
+
*/
|
|
167
|
+
clearCache(): void;
|
|
168
|
+
}
|
|
169
|
+
export default PatternDetectionManager;
|