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,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HybridMLManager for advanced PDF analysis using machine learning
|
|
3
|
+
*
|
|
4
|
+
* Analyzes PDF pages for complexity, content type, and optimal extraction strategies.
|
|
5
|
+
* API is consistent with Python, Java, C#, Go, and Swift implementations.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
/**
|
|
9
|
+
* Page complexity levels
|
|
10
|
+
*/
|
|
11
|
+
export var PageComplexity;
|
|
12
|
+
(function (PageComplexity) {
|
|
13
|
+
PageComplexity["Simple"] = "simple";
|
|
14
|
+
PageComplexity["Moderate"] = "moderate";
|
|
15
|
+
PageComplexity["Complex"] = "complex";
|
|
16
|
+
PageComplexity["VeryComplex"] = "very_complex";
|
|
17
|
+
})(PageComplexity || (PageComplexity = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Content type classifications
|
|
20
|
+
*/
|
|
21
|
+
export var ContentType;
|
|
22
|
+
(function (ContentType) {
|
|
23
|
+
ContentType["TextOnly"] = "text_only";
|
|
24
|
+
ContentType["TextImages"] = "text_images";
|
|
25
|
+
ContentType["Tables"] = "tables";
|
|
26
|
+
ContentType["MixedLayout"] = "mixed_layout";
|
|
27
|
+
ContentType["Scanned"] = "scanned";
|
|
28
|
+
ContentType["Form"] = "form";
|
|
29
|
+
ContentType["VectorGraphics"] = "vector_graphics";
|
|
30
|
+
})(ContentType || (ContentType = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Hybrid ML Manager for advanced PDF analysis
|
|
33
|
+
*
|
|
34
|
+
* Provides methods to:
|
|
35
|
+
* - Analyze page complexity
|
|
36
|
+
* - Detect content types
|
|
37
|
+
* - Recommend extraction strategies
|
|
38
|
+
* - Detect tables and columns
|
|
39
|
+
* - Estimate processing time
|
|
40
|
+
*/
|
|
41
|
+
export class HybridMLManager extends EventEmitter {
|
|
42
|
+
constructor(document) {
|
|
43
|
+
super();
|
|
44
|
+
this.resultCache = new Map();
|
|
45
|
+
this.maxCacheSize = 100;
|
|
46
|
+
this.document = document;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Analyzes a specific page
|
|
50
|
+
* Matches: Python analyzePage(), Java analyzePage(), C# AnalyzePage()
|
|
51
|
+
*/
|
|
52
|
+
async analyzePage(pageIndex) {
|
|
53
|
+
const cacheKey = `ml:analysis:${pageIndex}`;
|
|
54
|
+
if (this.resultCache.has(cacheKey)) {
|
|
55
|
+
return this.resultCache.get(cacheKey);
|
|
56
|
+
}
|
|
57
|
+
// In real implementation, would call native FFI
|
|
58
|
+
const result = {
|
|
59
|
+
pageIndex,
|
|
60
|
+
complexity: PageComplexity.Moderate,
|
|
61
|
+
complexityScore: 0.5,
|
|
62
|
+
contentType: ContentType.TextImages,
|
|
63
|
+
textDensity: 0.7,
|
|
64
|
+
imageDensity: 0.3,
|
|
65
|
+
hasText: true,
|
|
66
|
+
hasImages: false,
|
|
67
|
+
hasTables: false,
|
|
68
|
+
estimatedProcessingTime: 100,
|
|
69
|
+
};
|
|
70
|
+
this.setCached(cacheKey, result);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Analyzes all pages in the document
|
|
75
|
+
* Matches: Python analyzeDocument(), Java analyzeDocument(), C# AnalyzeDocument()
|
|
76
|
+
*/
|
|
77
|
+
async analyzeDocument() {
|
|
78
|
+
const cacheKey = 'ml:analysis:all';
|
|
79
|
+
if (this.resultCache.has(cacheKey)) {
|
|
80
|
+
return this.resultCache.get(cacheKey);
|
|
81
|
+
}
|
|
82
|
+
// In real implementation, would call native FFI
|
|
83
|
+
const results = [];
|
|
84
|
+
this.setCached(cacheKey, results);
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets extraction strategy recommendation for a page
|
|
89
|
+
* Matches: Python getExtractionStrategy(), Java getExtractionStrategy(), C# GetExtractionStrategy()
|
|
90
|
+
*/
|
|
91
|
+
async getExtractionStrategy(pageIndex) {
|
|
92
|
+
const cacheKey = `ml:strategy:${pageIndex}`;
|
|
93
|
+
if (this.resultCache.has(cacheKey)) {
|
|
94
|
+
return this.resultCache.get(cacheKey);
|
|
95
|
+
}
|
|
96
|
+
// In real implementation, would call native FFI
|
|
97
|
+
const strategy = {
|
|
98
|
+
pageIndex,
|
|
99
|
+
description: 'Standard text extraction recommended',
|
|
100
|
+
recommendsOcr: false,
|
|
101
|
+
recommendedMethod: 'text_extraction',
|
|
102
|
+
confidence: 0.9,
|
|
103
|
+
};
|
|
104
|
+
this.setCached(cacheKey, strategy);
|
|
105
|
+
return strategy;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Detects tables on a page
|
|
109
|
+
* Matches: Python detectTables(), Java detectTables(), C# DetectTables()
|
|
110
|
+
*/
|
|
111
|
+
async detectTables(pageIndex) {
|
|
112
|
+
const cacheKey = `ml:tables:${pageIndex}`;
|
|
113
|
+
if (this.resultCache.has(cacheKey)) {
|
|
114
|
+
return this.resultCache.get(cacheKey);
|
|
115
|
+
}
|
|
116
|
+
// In real implementation, would call native FFI
|
|
117
|
+
const tables = [];
|
|
118
|
+
this.setCached(cacheKey, tables);
|
|
119
|
+
return tables;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Detects columns on a page
|
|
123
|
+
* Matches: Python detectColumns(), Java detectColumns(), C# DetectColumns()
|
|
124
|
+
*/
|
|
125
|
+
async detectColumns(pageIndex) {
|
|
126
|
+
const cacheKey = `ml:columns:${pageIndex}`;
|
|
127
|
+
if (this.resultCache.has(cacheKey)) {
|
|
128
|
+
return this.resultCache.get(cacheKey);
|
|
129
|
+
}
|
|
130
|
+
// In real implementation, would call native FFI
|
|
131
|
+
const columns = [];
|
|
132
|
+
this.setCached(cacheKey, columns);
|
|
133
|
+
return columns;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets average page complexity in document
|
|
137
|
+
* Matches: Python getAverageComplexity(), Java getAverageComplexity(), C# GetAverageComplexity()
|
|
138
|
+
*/
|
|
139
|
+
async getAverageComplexity() {
|
|
140
|
+
const cacheKey = 'ml:avg_complexity';
|
|
141
|
+
if (this.resultCache.has(cacheKey)) {
|
|
142
|
+
return this.resultCache.get(cacheKey);
|
|
143
|
+
}
|
|
144
|
+
// In real implementation, would call native FFI
|
|
145
|
+
const complexity = 0.5;
|
|
146
|
+
this.setCached(cacheKey, complexity);
|
|
147
|
+
return complexity;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Gets most common content type
|
|
151
|
+
* Matches: Python getMostCommonContentType(), Java getMostCommonContentType(), C# GetMostCommonContentType()
|
|
152
|
+
*/
|
|
153
|
+
async getMostCommonContentType() {
|
|
154
|
+
const cacheKey = 'ml:common_content_type';
|
|
155
|
+
if (this.resultCache.has(cacheKey)) {
|
|
156
|
+
return this.resultCache.get(cacheKey);
|
|
157
|
+
}
|
|
158
|
+
// In real implementation, would call native FFI
|
|
159
|
+
const contentType = ContentType.TextImages;
|
|
160
|
+
this.setCached(cacheKey, contentType);
|
|
161
|
+
return contentType;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Estimates total document processing time
|
|
165
|
+
* Matches: Python estimateProcessingTime(), Java estimateProcessingTime(), C# EstimateProcessingTime()
|
|
166
|
+
*/
|
|
167
|
+
async estimateProcessingTime() {
|
|
168
|
+
const cacheKey = 'ml:estimated_time';
|
|
169
|
+
if (this.resultCache.has(cacheKey)) {
|
|
170
|
+
return this.resultCache.get(cacheKey);
|
|
171
|
+
}
|
|
172
|
+
// In real implementation, would call native FFI
|
|
173
|
+
const time = 1000;
|
|
174
|
+
this.setCached(cacheKey, time);
|
|
175
|
+
return time;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Clears the result cache
|
|
179
|
+
* Matches: Python clearCache(), Java clearCache(), C# ClearCache()
|
|
180
|
+
*/
|
|
181
|
+
clearCache() {
|
|
182
|
+
this.resultCache.clear();
|
|
183
|
+
this.emit('cacheCleared');
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Gets cache statistics
|
|
187
|
+
* Matches: Python getCacheStats(), Java getCacheStats(), C# GetCacheStats()
|
|
188
|
+
*/
|
|
189
|
+
getCacheStats() {
|
|
190
|
+
return {
|
|
191
|
+
cacheSize: this.resultCache.size,
|
|
192
|
+
maxCacheSize: this.maxCacheSize,
|
|
193
|
+
entries: Array.from(this.resultCache.keys()),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
// Private helper methods
|
|
197
|
+
setCached(key, value) {
|
|
198
|
+
this.resultCache.set(key, value);
|
|
199
|
+
// Simple LRU eviction
|
|
200
|
+
if (this.resultCache.size > this.maxCacheSize) {
|
|
201
|
+
const firstKey = this.resultCache.keys().next().value;
|
|
202
|
+
if (firstKey !== undefined) {
|
|
203
|
+
this.resultCache.delete(firstKey);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export default HybridMLManager;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { Align, AnnotationBuilder, ConversionOptionsBuilder, DocumentBuilder, EmbeddedFont, MetadataBuilder, PageBuilder, PdfBuilder, SearchOptionsBuilder, StreamingTable } from './builders/index';
|
|
2
|
+
import { DocumentEditor } from './document-editor';
|
|
3
|
+
import { AccessibilityException, CertificateLoadFailed, ComplianceException, EncryptionException, ErrorCategory, ErrorSeverity, InvalidStateException, IoException, mapFfiErrorCode, OcrException, OptimizationException, ParseException, PdfException, RedactionException, RenderingException, SearchException, SignatureException, SigningFailed, UnknownError, UnsupportedFeatureException, ValidationException, wrapAsyncMethod, wrapError, wrapMethod } from './errors';
|
|
4
|
+
import { AnnotationManager, type BatchDocument, BatchManager, type BatchOptions, type BatchProgress, type BatchResult, type BatchStatistics, createExtractionStream, createMetadataStream, createSearchStream, ExtractionManager, ExtractionStream, LayerManager, MetadataManager, MetadataStream, OutlineManager, RenderingManager, SearchManager, SearchStream, SecurityManager } from './managers/index';
|
|
5
|
+
import type { Column, SpanCell, StreamingTableConfig, Table, TableMode, TableSpec } from './types/common.js';
|
|
6
|
+
import type { WorkerResult, WorkerTask } from './workers/index';
|
|
7
|
+
import { WorkerPool, workerPool } from './workers/index';
|
|
8
|
+
declare const OcrManager: any, OCRManager: any, OCRDetectionMode: any, ComplianceManager: any, PdfALevel: any, PdfXLevel: any, PdfUALevel: any, ComplianceIssueType: any, IssueSeverity: any, SignatureManager: any, SignatureAlgorithm: any, DigestAlgorithm: any, BarcodeManager: any, BarcodeFormat: any, BarcodeErrorCorrection: any, FormFieldManager: any, FormFieldType: any, FieldVisibility: any, ResultAccessorsManager: any, SearchResultProperties: any, FontProperties: any, ImageProperties: any, AnnotationProperties: any, ThumbnailManager: any, ThumbnailSize: any, ImageFormat: any, HybridMLManager: any, PageComplexity: any, ContentType: any, XfaManager: any, XfaFormType: any, XfaFieldType: any, CacheManager: any, EditingManager: any, AccessibilityManager: any, OptimizationManager: any, EnterpriseManager: any;
|
|
9
|
+
declare const OCRLanguage: any;
|
|
10
|
+
/**
|
|
11
|
+
* Options mirroring Rust's `RenderOptions` struct
|
|
12
|
+
* (see `src/rendering/page_renderer.rs:41`). Used by
|
|
13
|
+
* {@link PdfDocumentImpl.renderPageWithOptions}.
|
|
14
|
+
*/
|
|
15
|
+
export interface RenderOptions {
|
|
16
|
+
/** Resolution (default 150). */
|
|
17
|
+
dpi?: number;
|
|
18
|
+
/** Output format (default PNG). */
|
|
19
|
+
format?: 'png' | 'jpeg';
|
|
20
|
+
/** RGBA 0..=1 tuple (default opaque white). */
|
|
21
|
+
background?: [number, number, number, number];
|
|
22
|
+
/** Drop background fill entirely (overrides `background`). */
|
|
23
|
+
transparentBackground?: boolean;
|
|
24
|
+
/** Render annotation layer (default true). */
|
|
25
|
+
renderAnnotations?: boolean;
|
|
26
|
+
/** JPEG quality 1..=100 (default 85). */
|
|
27
|
+
jpegQuality?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Raw premultiplied RGBA8888 pixel buffer. Layout: row-major, top-left origin,
|
|
31
|
+
* 4 bytes (R,G,B,A) per pixel, `data.length === width * height * 4`.
|
|
32
|
+
* Alpha is premultiplied (PDF spec §11 transparency model).
|
|
33
|
+
*/
|
|
34
|
+
export interface RgbaPixmap {
|
|
35
|
+
data: Buffer;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}
|
|
39
|
+
declare class PdfDocumentImpl {
|
|
40
|
+
private _handle;
|
|
41
|
+
private _closed;
|
|
42
|
+
/** Promise-cached mutex; single Promise ensures no race on concurrent first calls. */
|
|
43
|
+
private _muPromise;
|
|
44
|
+
constructor(handle: any);
|
|
45
|
+
static open(path: string): PdfDocumentImpl;
|
|
46
|
+
static openFromBuffer(buffer: Buffer | Uint8Array): PdfDocumentImpl;
|
|
47
|
+
static openWithPassword(path: string, password: string): PdfDocumentImpl;
|
|
48
|
+
private ensureOpen;
|
|
49
|
+
get handle(): any;
|
|
50
|
+
pageCount(): number;
|
|
51
|
+
getPageCount(): number;
|
|
52
|
+
get PageCount(): number;
|
|
53
|
+
extractText(pageIndex: number): string;
|
|
54
|
+
toMarkdown(pageIndex: number): string;
|
|
55
|
+
toHtml(pageIndex: number): string;
|
|
56
|
+
toPlainText(pageIndex: number): string;
|
|
57
|
+
toMarkdownAll(): string;
|
|
58
|
+
extractAllText(): string;
|
|
59
|
+
toHtmlAll(): string;
|
|
60
|
+
toPlainTextAll(): string;
|
|
61
|
+
getVersion(): {
|
|
62
|
+
major: number;
|
|
63
|
+
minor: number;
|
|
64
|
+
};
|
|
65
|
+
hasStructureTree(): boolean;
|
|
66
|
+
hasXFA(): boolean;
|
|
67
|
+
getPageWidth(pageIndex: number): number;
|
|
68
|
+
getPageHeight(pageIndex: number): number;
|
|
69
|
+
getPageRotation(pageIndex: number): number;
|
|
70
|
+
searchPage(pageIndex: number, query: string, caseSensitive?: boolean): any;
|
|
71
|
+
searchAll(query: string, caseSensitive?: boolean): any;
|
|
72
|
+
getFormFields(): any;
|
|
73
|
+
getOutline(): any;
|
|
74
|
+
getPageAnnotations(pageIndex: number): any;
|
|
75
|
+
getEmbeddedFonts(pageIndex: number): any;
|
|
76
|
+
getEmbeddedImages(pageIndex: number): any;
|
|
77
|
+
extractWords(pageIndex: number): any;
|
|
78
|
+
extractTextLines(pageIndex: number): any;
|
|
79
|
+
extractTables(pageIndex: number): Table[];
|
|
80
|
+
extractPaths(pageIndex: number): any;
|
|
81
|
+
ocrExtractText(pageIndex: number, engineHandle: any): any;
|
|
82
|
+
/**
|
|
83
|
+
* Render a page with the full Rust `RenderOptions` surface
|
|
84
|
+
* (DPI, format, RGBA background, transparency, annotation toggle,
|
|
85
|
+
* JPEG quality). Returns the image bytes.
|
|
86
|
+
*/
|
|
87
|
+
renderPageWithOptions(pageIndex: number, options?: RenderOptions): Uint8Array;
|
|
88
|
+
/**
|
|
89
|
+
* Estimate render time (milliseconds) for a page at a given DPI.
|
|
90
|
+
* Thin wrapper around the existing `estimateRenderTime` N-API
|
|
91
|
+
* export — exposed in TS for the first time as part of gap L.
|
|
92
|
+
*/
|
|
93
|
+
estimateRenderTime(pageIndex: number, dpi?: number): number;
|
|
94
|
+
/**
|
|
95
|
+
* Render a page to fit inside a `width × height` pixel box, preserving
|
|
96
|
+
* aspect ratio. Picks the largest DPI such that both rendered
|
|
97
|
+
* dimensions are ≤ the target box, so the output may be smaller than
|
|
98
|
+
* `width × height` on one axis. Issue #448.
|
|
99
|
+
*
|
|
100
|
+
* @param pageIndex zero-based page index
|
|
101
|
+
* @param width target box width (pixels, must be > 0)
|
|
102
|
+
* @param height target box height (pixels, must be > 0)
|
|
103
|
+
* @param format `'png'` (default) or `'jpeg'`
|
|
104
|
+
*/
|
|
105
|
+
renderPageFit(pageIndex: number, width: number, height: number, format?: 'png' | 'jpeg'): Uint8Array;
|
|
106
|
+
/** Lazy-initialises the per-instance Mutex (avoids a hard dep at load time). */
|
|
107
|
+
private _getMutex;
|
|
108
|
+
/**
|
|
109
|
+
* Async variant of {@link renderPageWithOptions} serialised through a
|
|
110
|
+
* per-instance mutex. Use when calling from `worker_threads` or `Promise.all`.
|
|
111
|
+
*/
|
|
112
|
+
renderPageWithOptionsAsync(pageIndex: number, options?: RenderOptions): Promise<Uint8Array>;
|
|
113
|
+
/**
|
|
114
|
+
* Async variant of {@link renderPageFit} serialised through a per-instance mutex.
|
|
115
|
+
*/
|
|
116
|
+
renderPageFitAsync(pageIndex: number, width: number, height: number, format?: 'png' | 'jpeg'): Promise<Uint8Array>;
|
|
117
|
+
/**
|
|
118
|
+
* Renders a page as raw premultiplied RGBA8888 pixels. No PNG/JPEG encoding
|
|
119
|
+
* overhead — useful for direct handoff to image-processing libraries.
|
|
120
|
+
* @param pageIndex Zero-based page index.
|
|
121
|
+
* @param dpi Resolution in dots per inch (default 150).
|
|
122
|
+
*/
|
|
123
|
+
renderToPixmap(pageIndex: number, dpi?: number): RgbaPixmap;
|
|
124
|
+
/**
|
|
125
|
+
* Async variant of {@link renderToPixmap} serialised through a per-instance mutex.
|
|
126
|
+
*/
|
|
127
|
+
renderToPixmapAsync(pageIndex: number, dpi?: number): Promise<RgbaPixmap>;
|
|
128
|
+
page(index: number): Page;
|
|
129
|
+
[Symbol.iterator](): Iterator<Page>;
|
|
130
|
+
/**
|
|
131
|
+
* Async iteration over the document's pages — issue #447. The body
|
|
132
|
+
* is identical to the sync iterator (page handles are constructed
|
|
133
|
+
* synchronously) but exposing this surface lets consumers `for await`
|
|
134
|
+
* uniformly with other async resources without an explicit
|
|
135
|
+
* `Promise.resolve(...)`.
|
|
136
|
+
*/
|
|
137
|
+
[Symbol.asyncIterator](): AsyncIterator<Page>;
|
|
138
|
+
/**
|
|
139
|
+
* Validate PDF/A conformance at a given level.
|
|
140
|
+
* @param level - "1a"|"1b"|"2a"|"2b"|"2u"|"3a"|"3b"|"3u" (default "2b")
|
|
141
|
+
*/
|
|
142
|
+
validatePdfA(level?: '1a' | '1b' | '2a' | '2b' | '2u' | '3a' | '3b' | '3u'): {
|
|
143
|
+
compliant: boolean;
|
|
144
|
+
errors: string[];
|
|
145
|
+
warnings: string[];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Convert document to PDF/A conformance in-place.
|
|
149
|
+
* @param level - "1b"|"2b"|"2u"|"3b" etc. (default "2b")
|
|
150
|
+
* @returns true if the document is fully PDF/A-compliant after conversion (false if errors remain, e.g. fonts not embeddable without the rendering feature)
|
|
151
|
+
*/
|
|
152
|
+
convertToPdfA(level?: '1a' | '1b' | '2a' | '2b' | '2u' | '3a' | '3b' | '3u'): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Return the current document bytes (including any in-place modifications
|
|
155
|
+
* made by convertToPdfA).
|
|
156
|
+
*/
|
|
157
|
+
toBuffer(): Buffer;
|
|
158
|
+
close(): void;
|
|
159
|
+
[Symbol.dispose](): void;
|
|
160
|
+
}
|
|
161
|
+
declare class Page {
|
|
162
|
+
private _doc;
|
|
163
|
+
private _index;
|
|
164
|
+
private _cache;
|
|
165
|
+
constructor(doc: PdfDocumentImpl, index: number);
|
|
166
|
+
get index(): number;
|
|
167
|
+
get width(): number;
|
|
168
|
+
get height(): number;
|
|
169
|
+
get rotation(): number;
|
|
170
|
+
text(): string;
|
|
171
|
+
markdown(): string;
|
|
172
|
+
html(): string;
|
|
173
|
+
plainText(): string;
|
|
174
|
+
words(): any;
|
|
175
|
+
lines(): any;
|
|
176
|
+
tables(): Table[];
|
|
177
|
+
images(): any;
|
|
178
|
+
paths(): any;
|
|
179
|
+
annotations(): any;
|
|
180
|
+
fonts(): any;
|
|
181
|
+
search(query: string, caseSensitive?: boolean): any;
|
|
182
|
+
toString(): string;
|
|
183
|
+
}
|
|
184
|
+
declare function generateBarcodeSvg(data: string, format?: number, sizePx?: number): string;
|
|
185
|
+
declare function generateQrCodeSvg(data: string, errorCorrection?: number, sizePx?: number): string;
|
|
186
|
+
declare const getVersion: any;
|
|
187
|
+
declare const getPdfOxideVersion: any;
|
|
188
|
+
declare const getActiveCryptoProvider: any;
|
|
189
|
+
declare const isFipsCryptoAvailable: any;
|
|
190
|
+
declare const useFipsCryptoProvider: any;
|
|
191
|
+
declare const PdfDocument: any;
|
|
192
|
+
declare const Pdf: any;
|
|
193
|
+
declare const PdfError: typeof PdfException;
|
|
194
|
+
declare const PageSize: any;
|
|
195
|
+
declare const Rect: any;
|
|
196
|
+
declare const Point: any;
|
|
197
|
+
declare const Color: any;
|
|
198
|
+
declare const ConversionOptions: any;
|
|
199
|
+
declare const SearchOptions: any;
|
|
200
|
+
declare const SearchResult: any;
|
|
201
|
+
declare const TextSearcher: any;
|
|
202
|
+
export { Timestamp, TimestampHashAlgorithm } from './timestamp.js';
|
|
203
|
+
export { TsaClient, type TsaClientOptions } from './tsa-client.js';
|
|
204
|
+
export type { BatchDocument, BatchOptions, BatchProgress, BatchResult, BatchStatistics, Column, SpanCell, StreamingTableConfig, Table, TableMode, TableSpec, WorkerResult, WorkerTask, };
|
|
205
|
+
export { AccessibilityException, AccessibilityManager, Align, AnnotationBuilder, AnnotationManager, AnnotationProperties, BarcodeErrorCorrection, BarcodeFormat, BarcodeManager, BatchManager, CacheManager, CertificateLoadFailed, Color, ComplianceException, ComplianceIssueType, ComplianceManager, ContentType, ConversionOptions, ConversionOptionsBuilder, createExtractionStream, createMetadataStream, createSearchStream, DigestAlgorithm, DocumentBuilder, DocumentEditor, EditingManager, EmbeddedFont, EncryptionException, EnterpriseManager, ErrorCategory, ErrorSeverity, ExtractionManager, ExtractionStream, FieldVisibility, FontProperties, FormFieldManager, FormFieldType, generateBarcodeSvg, generateQrCodeSvg, getActiveCryptoProvider, getPdfOxideVersion, getVersion, HybridMLManager, ImageFormat, ImageProperties, InvalidStateException, IoException, IssueSeverity, isFipsCryptoAvailable, LayerManager, MetadataBuilder, MetadataManager, MetadataStream, mapFfiErrorCode, OCRDetectionMode, OCRLanguage, OCRManager, OcrException, OcrManager, OptimizationException, OptimizationManager, OutlineManager, Page, PageBuilder, PageComplexity, PageSize, ParseException, Pdf, PdfALevel, PdfBuilder, PdfDocument, PdfError, PdfException, PdfUALevel, PdfXLevel, Point, Rect, RedactionException, RenderingException, RenderingManager, ResultAccessorsManager, SearchException, SearchManager, SearchOptions, SearchOptionsBuilder, SearchResult, SearchResultProperties, SearchStream, SecurityManager, SignatureAlgorithm, SignatureException, SignatureManager, SigningFailed, StreamingTable, TextSearcher, ThumbnailManager, ThumbnailSize, UnknownError, UnsupportedFeatureException, useFipsCryptoProvider, ValidationException, WorkerPool, workerPool, wrapAsyncMethod, wrapError, wrapMethod, XfaFieldType, XfaFormType, XfaManager, };
|