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.
Files changed (127) hide show
  1. package/LICENSE-APACHE +176 -0
  2. package/LICENSE-MIT +25 -0
  3. package/README.md +218 -0
  4. package/lib/builders/annotation-builder.d.ts +198 -0
  5. package/lib/builders/annotation-builder.js +317 -0
  6. package/lib/builders/conversion-options-builder.d.ts +106 -0
  7. package/lib/builders/conversion-options-builder.js +214 -0
  8. package/lib/builders/document-builder.d.ts +381 -0
  9. package/lib/builders/document-builder.js +770 -0
  10. package/lib/builders/index.d.ts +13 -0
  11. package/lib/builders/index.js +13 -0
  12. package/lib/builders/metadata-builder.d.ts +201 -0
  13. package/lib/builders/metadata-builder.js +285 -0
  14. package/lib/builders/pdf-builder.d.ts +216 -0
  15. package/lib/builders/pdf-builder.js +350 -0
  16. package/lib/builders/search-options-builder.d.ts +73 -0
  17. package/lib/builders/search-options-builder.js +129 -0
  18. package/lib/builders/streaming-table.d.ts +64 -0
  19. package/lib/builders/streaming-table.js +140 -0
  20. package/lib/document-editor-manager.d.ts +139 -0
  21. package/lib/document-editor-manager.js +256 -0
  22. package/lib/document-editor.d.ts +124 -0
  23. package/lib/document-editor.js +318 -0
  24. package/lib/errors.d.ts +382 -0
  25. package/lib/errors.js +1115 -0
  26. package/lib/form-field-manager.d.ts +299 -0
  27. package/lib/form-field-manager.js +568 -0
  28. package/lib/hybrid-ml-manager.d.ts +142 -0
  29. package/lib/hybrid-ml-manager.js +208 -0
  30. package/lib/index.d.ts +205 -0
  31. package/lib/index.js +693 -0
  32. package/lib/managers/accessibility-manager.d.ts +148 -0
  33. package/lib/managers/accessibility-manager.js +234 -0
  34. package/lib/managers/annotation-manager.d.ts +219 -0
  35. package/lib/managers/annotation-manager.js +359 -0
  36. package/lib/managers/barcode-manager.d.ts +82 -0
  37. package/lib/managers/barcode-manager.js +263 -0
  38. package/lib/managers/batch-manager.d.ts +185 -0
  39. package/lib/managers/batch-manager.js +385 -0
  40. package/lib/managers/cache-manager.d.ts +181 -0
  41. package/lib/managers/cache-manager.js +384 -0
  42. package/lib/managers/compliance-manager.d.ts +103 -0
  43. package/lib/managers/compliance-manager.js +453 -0
  44. package/lib/managers/content-manager.d.ts +120 -0
  45. package/lib/managers/content-manager.js +294 -0
  46. package/lib/managers/document-utility-manager.d.ts +369 -0
  47. package/lib/managers/document-utility-manager.js +730 -0
  48. package/lib/managers/dom-pdf-creator.d.ts +104 -0
  49. package/lib/managers/dom-pdf-creator.js +299 -0
  50. package/lib/managers/editing-manager.d.ts +248 -0
  51. package/lib/managers/editing-manager.js +387 -0
  52. package/lib/managers/enterprise-manager.d.ts +192 -0
  53. package/lib/managers/enterprise-manager.js +307 -0
  54. package/lib/managers/extended-managers.d.ts +122 -0
  55. package/lib/managers/extended-managers.js +664 -0
  56. package/lib/managers/extraction-manager.d.ts +246 -0
  57. package/lib/managers/extraction-manager.js +482 -0
  58. package/lib/managers/final-utilities.d.ts +127 -0
  59. package/lib/managers/final-utilities.js +657 -0
  60. package/lib/managers/hybrid-ml-advanced.d.ts +136 -0
  61. package/lib/managers/hybrid-ml-advanced.js +722 -0
  62. package/lib/managers/index.d.ts +64 -0
  63. package/lib/managers/index.js +69 -0
  64. package/lib/managers/layer-manager.d.ts +203 -0
  65. package/lib/managers/layer-manager.js +401 -0
  66. package/lib/managers/metadata-manager.d.ts +148 -0
  67. package/lib/managers/metadata-manager.js +280 -0
  68. package/lib/managers/ocr-manager.d.ts +194 -0
  69. package/lib/managers/ocr-manager.js +582 -0
  70. package/lib/managers/optimization-manager.d.ts +102 -0
  71. package/lib/managers/optimization-manager.js +213 -0
  72. package/lib/managers/outline-manager.d.ts +101 -0
  73. package/lib/managers/outline-manager.js +169 -0
  74. package/lib/managers/page-manager.d.ts +142 -0
  75. package/lib/managers/page-manager.js +235 -0
  76. package/lib/managers/pattern-detection.d.ts +169 -0
  77. package/lib/managers/pattern-detection.js +322 -0
  78. package/lib/managers/rendering-manager.d.ts +353 -0
  79. package/lib/managers/rendering-manager.js +679 -0
  80. package/lib/managers/search-manager.d.ts +235 -0
  81. package/lib/managers/search-manager.js +329 -0
  82. package/lib/managers/security-manager.d.ts +161 -0
  83. package/lib/managers/security-manager.js +292 -0
  84. package/lib/managers/signature-manager.d.ts +738 -0
  85. package/lib/managers/signature-manager.js +1509 -0
  86. package/lib/managers/streams.d.ts +262 -0
  87. package/lib/managers/streams.js +477 -0
  88. package/lib/managers/xfa-manager.d.ts +227 -0
  89. package/lib/managers/xfa-manager.js +539 -0
  90. package/lib/native-loader.d.ts +7 -0
  91. package/lib/native-loader.js +62 -0
  92. package/lib/native.d.ts +16 -0
  93. package/lib/native.js +69 -0
  94. package/lib/pdf-creator-manager.d.ts +200 -0
  95. package/lib/pdf-creator-manager.js +381 -0
  96. package/lib/properties.d.ts +79 -0
  97. package/lib/properties.js +454 -0
  98. package/lib/result-accessors-manager.d.ts +346 -0
  99. package/lib/result-accessors-manager.js +706 -0
  100. package/lib/thumbnail-manager.d.ts +121 -0
  101. package/lib/thumbnail-manager.js +205 -0
  102. package/lib/timestamp.d.ts +54 -0
  103. package/lib/timestamp.js +115 -0
  104. package/lib/tsa-client.d.ts +44 -0
  105. package/lib/tsa-client.js +67 -0
  106. package/lib/types/common.d.ts +189 -0
  107. package/lib/types/common.js +17 -0
  108. package/lib/types/document-types.d.ts +352 -0
  109. package/lib/types/document-types.js +82 -0
  110. package/lib/types/index.d.ts +5 -0
  111. package/lib/types/index.js +5 -0
  112. package/lib/types/manager-types.d.ts +179 -0
  113. package/lib/types/manager-types.js +100 -0
  114. package/lib/types/native-bindings.d.ts +439 -0
  115. package/lib/types/native-bindings.js +7 -0
  116. package/lib/workers/index.d.ts +6 -0
  117. package/lib/workers/index.js +5 -0
  118. package/lib/workers/pool.d.ts +64 -0
  119. package/lib/workers/pool.js +192 -0
  120. package/lib/workers/worker.d.ts +5 -0
  121. package/lib/workers/worker.js +99 -0
  122. package/package.json +79 -0
  123. package/prebuilds/darwin-arm64/pdf_oxide.node +0 -0
  124. package/prebuilds/darwin-x64/pdf_oxide.node +0 -0
  125. package/prebuilds/linux-arm64/pdf_oxide.node +0 -0
  126. package/prebuilds/linux-x64/pdf_oxide.node +0 -0
  127. package/prebuilds/win32-x64/pdf_oxide.node +0 -0
@@ -0,0 +1,322 @@
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
+ /**
12
+ * Layout pattern type enumeration.
13
+ */
14
+ export var LayoutPatternType;
15
+ (function (LayoutPatternType) {
16
+ LayoutPatternType["SINGLE_COLUMN"] = "single_column";
17
+ LayoutPatternType["MULTI_COLUMN"] = "multi_column";
18
+ LayoutPatternType["TABLE_BASED"] = "table_based";
19
+ LayoutPatternType["FORM_BASED"] = "form_based";
20
+ LayoutPatternType["MAGAZINE_STYLE"] = "magazine_style";
21
+ LayoutPatternType["COMPLEX_MIXED"] = "complex_mixed";
22
+ })(LayoutPatternType || (LayoutPatternType = {}));
23
+ /**
24
+ * Pattern Detection Manager for TypeScript/Node.js
25
+ *
26
+ * Provides detection and analysis of common patterns in PDF documents.
27
+ */
28
+ export class PatternDetectionManager {
29
+ /**
30
+ * Create a new PatternDetectionManager.
31
+ */
32
+ constructor(document) {
33
+ this.cache = new Map();
34
+ this.document = document;
35
+ }
36
+ /**
37
+ * Detect tables on a specific page.
38
+ *
39
+ * @param pageIndex - Index of the page to analyze
40
+ * @returns Array of detected table regions
41
+ */
42
+ async detectTables(pageIndex) {
43
+ const cacheKey = `tables:${pageIndex}`;
44
+ const cached = this.cache.get(cacheKey);
45
+ if (cached) {
46
+ return cached;
47
+ }
48
+ // Extract text to analyze
49
+ const text = await this.document.extractText(pageIndex);
50
+ if (!text) {
51
+ return [];
52
+ }
53
+ // Simple heuristic: detect table-like patterns
54
+ const tables = [];
55
+ const lines = text.split('\n');
56
+ // Look for lines with multiple columns (tabs or spaces)
57
+ let currentTableStart = -1;
58
+ let tableLines = 0;
59
+ for (let i = 0; i < lines.length; i++) {
60
+ const line = lines[i];
61
+ const columnCount = (line?.match(/\t/g) || []).length + 1;
62
+ if (columnCount >= 2) {
63
+ if (currentTableStart === -1) {
64
+ currentTableStart = i;
65
+ }
66
+ tableLines++;
67
+ }
68
+ else if (currentTableStart !== -1 && tableLines > 1) {
69
+ // End of table detected
70
+ tables.push({
71
+ x: 50,
72
+ y: 100 + currentTableStart * 15,
73
+ width: 500,
74
+ height: tableLines * 15,
75
+ rowCount: tableLines,
76
+ columnCount: (lines[currentTableStart]?.match(/\t/g) || []).length + 1,
77
+ confidence: 0.7,
78
+ });
79
+ currentTableStart = -1;
80
+ tableLines = 0;
81
+ }
82
+ }
83
+ this.cache.set(cacheKey, tables);
84
+ return tables;
85
+ }
86
+ /**
87
+ * Detect columns on a specific page.
88
+ *
89
+ * @param pageIndex - Index of the page to analyze
90
+ * @returns Array of detected column regions
91
+ */
92
+ async detectColumns(pageIndex) {
93
+ const cacheKey = `columns:${pageIndex}`;
94
+ const cached = this.cache.get(cacheKey);
95
+ if (cached) {
96
+ return cached;
97
+ }
98
+ const text = await this.document.extractText(pageIndex);
99
+ if (!text) {
100
+ return [];
101
+ }
102
+ // Simple heuristic: detect multi-column layouts
103
+ const columns = [];
104
+ const lines = text.split('\n');
105
+ // Check for indentation patterns suggesting columns
106
+ const indentationPattern = new Map();
107
+ for (const line of lines) {
108
+ if (line.length > 0) {
109
+ const indent = line.search(/\S/);
110
+ if (indent >= 0) {
111
+ indentationPattern.set(indent, (indentationPattern.get(indent) || 0) + 1);
112
+ }
113
+ }
114
+ }
115
+ // If multiple indentation levels, likely multi-column
116
+ if (indentationPattern.size > 1) {
117
+ const indents = Array.from(indentationPattern.entries())
118
+ .sort((a, b) => b[1] - a[1])
119
+ .slice(0, 2)
120
+ .map(([indent]) => indent);
121
+ for (let i = 0; i < indents.length; i++) {
122
+ columns.push({
123
+ x: (indents[i] ?? 0) * 8,
124
+ y: 50,
125
+ width: 250,
126
+ height: 700,
127
+ columnIndex: i,
128
+ confidence: 0.6,
129
+ });
130
+ }
131
+ }
132
+ else {
133
+ // Single column
134
+ columns.push({
135
+ x: 50,
136
+ y: 50,
137
+ width: 500,
138
+ height: 700,
139
+ columnIndex: 0,
140
+ confidence: 0.95,
141
+ });
142
+ }
143
+ this.cache.set(cacheKey, columns);
144
+ return columns;
145
+ }
146
+ /**
147
+ * Detect barcodes on a specific page.
148
+ *
149
+ * @param pageIndex - Index of the page to analyze
150
+ * @returns Array of detected barcodes
151
+ */
152
+ async detectBarcodes(pageIndex) {
153
+ const cacheKey = `barcodes:${pageIndex}`;
154
+ const cached = this.cache.get(cacheKey);
155
+ if (cached) {
156
+ return cached;
157
+ }
158
+ // This would typically involve barcode detection via FFI
159
+ // For now, return empty as this requires image processing
160
+ const barcodes = [];
161
+ this.cache.set(cacheKey, barcodes);
162
+ return barcodes;
163
+ }
164
+ /**
165
+ * Detect form fields on a specific page.
166
+ *
167
+ * @param pageIndex - Index of the page to analyze
168
+ * @returns Array of detected form fields
169
+ */
170
+ async detectFormFields(pageIndex) {
171
+ const cacheKey = `form_fields:${pageIndex}`;
172
+ const cached = this.cache.get(cacheKey);
173
+ if (cached) {
174
+ return cached;
175
+ }
176
+ // Try to extract form fields if available
177
+ let formFields = [];
178
+ try {
179
+ const fields = await this.document.extractFormFields();
180
+ formFields = fields
181
+ .filter((f) => f.pageIndex === pageIndex)
182
+ .map((f) => ({
183
+ x: f.x || 0,
184
+ y: f.y || 0,
185
+ width: f.width || 100,
186
+ height: f.height || 20,
187
+ fieldType: f.type || 'unknown',
188
+ fieldName: f.name,
189
+ confidence: 0.9,
190
+ }));
191
+ }
192
+ catch {
193
+ // If extraction fails, return empty array
194
+ }
195
+ this.cache.set(cacheKey, formFields);
196
+ return formFields;
197
+ }
198
+ /**
199
+ * Analyze layout pattern of a page.
200
+ *
201
+ * @param pageIndex - Index of the page to analyze
202
+ * @returns Detected layout pattern
203
+ */
204
+ async analyzeLayoutPattern(pageIndex) {
205
+ const cacheKey = `layout_pattern:${pageIndex}`;
206
+ const cached = this.cache.get(cacheKey);
207
+ if (cached) {
208
+ return cached;
209
+ }
210
+ // Detect tables and columns
211
+ const tables = await this.detectTables(pageIndex);
212
+ const columns = await this.detectColumns(pageIndex);
213
+ // Determine pattern type
214
+ let patternType = LayoutPatternType.SINGLE_COLUMN;
215
+ let confidence = 0.5;
216
+ if (tables.length > 0) {
217
+ patternType = LayoutPatternType.TABLE_BASED;
218
+ confidence = 0.85;
219
+ }
220
+ else if (columns.length > 1) {
221
+ patternType = LayoutPatternType.MULTI_COLUMN;
222
+ confidence = 0.75;
223
+ }
224
+ const pattern = {
225
+ pageIndex,
226
+ patternType,
227
+ confidence,
228
+ regions: [...tables, ...columns],
229
+ };
230
+ this.cache.set(cacheKey, pattern);
231
+ return pattern;
232
+ }
233
+ /**
234
+ * Detect all patterns on a specific page.
235
+ *
236
+ * @param pageIndex - Index of the page to analyze
237
+ * @returns Object with all detected patterns
238
+ */
239
+ async detectAllPatterns(pageIndex) {
240
+ const [tables, columns, barcodes, formFields, layout] = await Promise.all([
241
+ this.detectTables(pageIndex),
242
+ this.detectColumns(pageIndex),
243
+ this.detectBarcodes(pageIndex),
244
+ this.detectFormFields(pageIndex),
245
+ this.analyzeLayoutPattern(pageIndex),
246
+ ]);
247
+ return {
248
+ tables,
249
+ columns,
250
+ barcodes,
251
+ formFields,
252
+ layout,
253
+ };
254
+ }
255
+ /**
256
+ * Analyze patterns across entire document.
257
+ *
258
+ * @returns Array of layout patterns for each page
259
+ */
260
+ async analyzeDocumentPatterns() {
261
+ const pageCount = await this.document.pageCount();
262
+ const patterns = [];
263
+ for (let i = 0; i < pageCount; i++) {
264
+ try {
265
+ const pattern = await this.analyzeLayoutPattern(i);
266
+ patterns.push(pattern);
267
+ }
268
+ catch {
269
+ // Skip on error
270
+ }
271
+ }
272
+ return patterns;
273
+ }
274
+ /**
275
+ * Find pages with specific pattern type.
276
+ *
277
+ * @param patternType - Pattern type to find
278
+ * @returns Array of page indices with the specified pattern
279
+ */
280
+ async findPagesWithPattern(patternType) {
281
+ const patterns = await this.analyzeDocumentPatterns();
282
+ return patterns.filter((p) => p.patternType === patternType).map((p) => p.pageIndex);
283
+ }
284
+ /**
285
+ * Get pattern statistics for the document.
286
+ *
287
+ * @returns Statistics about detected patterns
288
+ */
289
+ async getPatternStatistics() {
290
+ const pageCount = await this.document.pageCount();
291
+ let totalTables = 0;
292
+ let totalColumns = 0;
293
+ let pagesWithTables = 0;
294
+ let pagesWithColumns = 0;
295
+ for (let i = 0; i < pageCount; i++) {
296
+ const tables = await this.detectTables(i);
297
+ const columns = await this.detectColumns(i);
298
+ if (tables.length > 0) {
299
+ pagesWithTables++;
300
+ totalTables += tables.length;
301
+ }
302
+ if (columns.length > 1) {
303
+ pagesWithColumns++;
304
+ totalColumns += columns.length;
305
+ }
306
+ }
307
+ return {
308
+ totalPages: pageCount,
309
+ pagesWithTables,
310
+ pagesWithColumns,
311
+ avgTablesPerPage: pagesWithTables > 0 ? totalTables / pagesWithTables : 0,
312
+ avgColumnsPerPage: pagesWithColumns > 0 ? totalColumns / pagesWithColumns : 0,
313
+ };
314
+ }
315
+ /**
316
+ * Clear the internal cache.
317
+ */
318
+ clearCache() {
319
+ this.cache.clear();
320
+ }
321
+ }
322
+ export default PatternDetectionManager;
@@ -0,0 +1,353 @@
1
+ /**
2
+ * Options for rendering pages to images
3
+ *
4
+ * Provides configurable settings for PDF page rendering including DPI,
5
+ * output format (PNG/JPEG), quality, and maximum dimensions.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const options = new RenderOptions({
10
+ * dpi: 300,
11
+ * format: 'png'
12
+ * });
13
+ * ```
14
+ */
15
+ export interface RenderOptionsConfig {
16
+ dpi?: number;
17
+ format?: 'png' | 'jpeg';
18
+ quality?: number;
19
+ maxWidth?: number | null;
20
+ maxHeight?: number | null;
21
+ }
22
+ export declare class RenderOptions {
23
+ dpi: number;
24
+ format: 'png' | 'jpeg';
25
+ quality: number;
26
+ maxWidth: number | null;
27
+ maxHeight: number | null;
28
+ /**
29
+ * Creates render options with defaults
30
+ * @param config - Configuration options
31
+ */
32
+ constructor(config?: RenderOptionsConfig);
33
+ /**
34
+ * Validates rendering options
35
+ * @private
36
+ */
37
+ private _validate;
38
+ /**
39
+ * Merges options with defaults, handling null/undefined gracefully
40
+ * @param options - Options to merge
41
+ * @returns Merged options
42
+ * @static
43
+ */
44
+ static merge(options?: RenderOptions | RenderOptionsConfig | null): RenderOptions;
45
+ /**
46
+ * Creates preset options for a quality level
47
+ * @param quality - Quality level: 'draft', 'normal', 'high'
48
+ * @returns Preset options
49
+ * @static
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const highQuality = RenderOptions.fromQuality('high');
54
+ * ```
55
+ */
56
+ static fromQuality(quality: 'draft' | 'normal' | 'high'): RenderOptions;
57
+ /**
58
+ * Converts to plain object for serialization
59
+ * @returns Plain object representation
60
+ */
61
+ toJSON(): Record<string, any>;
62
+ }
63
+ /**
64
+ * Page dimensions information
65
+ */
66
+ export interface PageDimensions {
67
+ width: number;
68
+ height: number;
69
+ unit: string;
70
+ widthPts?: number;
71
+ heightPts?: number;
72
+ rotation?: number;
73
+ }
74
+ /**
75
+ * Page box information
76
+ */
77
+ export interface PageBox {
78
+ x: number;
79
+ y: number;
80
+ width: number;
81
+ height: number;
82
+ }
83
+ /**
84
+ * Rendering statistics
85
+ */
86
+ export interface RenderingStatistics {
87
+ totalFonts: number;
88
+ totalImages: number;
89
+ avgPageSize: number;
90
+ colorSpaceCount: number;
91
+ pageCount: number;
92
+ maxResolution: number;
93
+ }
94
+ /**
95
+ * Page resources
96
+ */
97
+ export interface PageResources {
98
+ fonts: any[];
99
+ images: any[];
100
+ colorSpaces: string[];
101
+ patterns: any[];
102
+ }
103
+ /**
104
+ * Manager for PDF rendering options and capabilities
105
+ *
106
+ * Provides methods to manage PDF rendering settings, page dimensions,
107
+ * color spaces, and rendering-related properties.
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * import { RenderingManager } from 'pdf_oxide';
112
+ *
113
+ * const doc = PdfDocument.open('document.pdf');
114
+ * const renderingManager = new RenderingManager(doc);
115
+ *
116
+ * // Get page dimensions
117
+ * const dimensions = renderingManager.getPageDimensions(0);
118
+ * console.log(`Page size: ${dimensions.width}x${dimensions.height} ${dimensions.unit}`);
119
+ *
120
+ * // Render page to PNG
121
+ * const path = await renderingManager.renderPageToFile(0, 'page.png');
122
+ * ```
123
+ */
124
+ export declare class RenderingManager {
125
+ private _document;
126
+ private _dimensionCache;
127
+ private _resourceCache;
128
+ private _statisticsCache;
129
+ /**
130
+ * Creates a new RenderingManager for the given document
131
+ * @param document - The PDF document
132
+ * @throws Error if document is null or undefined
133
+ */
134
+ constructor(document: any);
135
+ /**
136
+ * Clears the rendering cache
137
+ * Useful when document content might have changed
138
+ */
139
+ clearCache(): void;
140
+ /**
141
+ * Gets maximum resolution supported
142
+ * @returns Maximum DPI
143
+ */
144
+ getMaxResolution(): number;
145
+ /**
146
+ * Gets supported color spaces
147
+ * @returns Array of color space names
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * const colorSpaces = manager.getSupportedColorSpaces();
152
+ * // ['RGB', 'CMYK', 'Grayscale', 'Lab']
153
+ * ```
154
+ */
155
+ getSupportedColorSpaces(): string[];
156
+ /**
157
+ * Gets dimensions of a page
158
+ * @param pageIndex - Zero-based page index
159
+ * @returns Page dimensions { width, height, unit }
160
+ * @throws Error if page index is invalid
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const dims = manager.getPageDimensions(0);
165
+ * console.log(`${dims.width}${dims.unit} x ${dims.height}${dims.unit}`);
166
+ * ```
167
+ */
168
+ getPageDimensions(pageIndex: number): PageDimensions;
169
+ /**
170
+ * Gets display size at specific zoom level
171
+ * @param pageIndex - Zero-based page index
172
+ * @param zoomLevel - Zoom level (0.5 = 50%, 1 = 100%, 2 = 200%, etc.)
173
+ * @returns Display dimensions { width, height, unit }
174
+ */
175
+ getDisplaySize(pageIndex: number, zoomLevel: number): PageDimensions;
176
+ /**
177
+ * Gets page rotation
178
+ * @param pageIndex - Zero-based page index
179
+ * @returns Rotation angle (0, 90, 180, or 270)
180
+ */
181
+ getPageRotation(pageIndex: number): number;
182
+ /**
183
+ * Gets page crop box (visible area)
184
+ * @param pageIndex - Zero-based page index
185
+ * @returns Crop box { x, y, width, height }
186
+ */
187
+ getPageCropBox(pageIndex: number): PageBox;
188
+ /**
189
+ * Gets page media box (full page size)
190
+ * @param pageIndex - Zero-based page index
191
+ * @returns Media box { x, y, width, height }
192
+ */
193
+ getPageMediaBox(pageIndex: number): PageBox;
194
+ /**
195
+ * Gets page bleed box (content meant for output)
196
+ * @param pageIndex - Zero-based page index
197
+ * @returns Bleed box { x, y, width, height }
198
+ */
199
+ getPageBleedBox(pageIndex: number): PageBox;
200
+ /**
201
+ * Gets page trim box (final page size after trimming)
202
+ * @param pageIndex - Zero-based page index
203
+ * @returns Trim box { x, y, width, height }
204
+ */
205
+ getPageTrimBox(pageIndex: number): PageBox;
206
+ /**
207
+ * Gets page art box (visible area for artwork)
208
+ * @param pageIndex - Zero-based page index
209
+ * @returns Art box { x, y, width, height }
210
+ */
211
+ getPageArtBox(pageIndex: number): PageBox;
212
+ /**
213
+ * Gets a specific page box
214
+ * @param pageIndex - Page index
215
+ * @param boxType - Box type: 'media', 'crop', 'bleed', 'trim', 'art'
216
+ * @returns Box dimensions
217
+ * @private
218
+ */
219
+ private _getPageBox;
220
+ /**
221
+ * Calculates zoom level for specific width
222
+ * @param pageIndex - Zero-based page index
223
+ * @param viewportWidth - Width in pixels
224
+ * @returns Zoom level (0.5 = 50%, etc.)
225
+ */
226
+ calculateZoomForWidth(pageIndex: number, viewportWidth: number): number;
227
+ /**
228
+ * Calculates zoom level for specific height
229
+ * @param pageIndex - Zero-based page index
230
+ * @param viewportHeight - Height in pixels
231
+ * @returns Zoom level
232
+ */
233
+ calculateZoomForHeight(pageIndex: number, viewportHeight: number): number;
234
+ /**
235
+ * Calculates zoom level to fit page in viewport
236
+ * @param pageIndex - Zero-based page index
237
+ * @param viewportWidth - Viewport width
238
+ * @param viewportHeight - Viewport height
239
+ * @returns Zoom level that fits page in viewport
240
+ */
241
+ calculateZoomToFit(pageIndex: number, viewportWidth: number, viewportHeight: number): number;
242
+ /**
243
+ * Gets embedded fonts on a page
244
+ * @param pageIndex - Zero-based page index
245
+ * @returns Array of font objects { name, embedded, subset }
246
+ */
247
+ getEmbeddedFonts(pageIndex: number): any[];
248
+ /**
249
+ * Gets embedded images on a page
250
+ * @param pageIndex - Zero-based page index
251
+ * @returns Array of image objects { name, width, height, colorSpace }
252
+ */
253
+ getEmbeddedImages(pageIndex: number): any[];
254
+ /**
255
+ * Gets comprehensive page resources
256
+ * @param pageIndex - Zero-based page index
257
+ * @returns Resources { fonts, images, colorSpaces, patterns }
258
+ */
259
+ getPageResources(pageIndex: number): PageResources;
260
+ /**
261
+ * Gets recommended resolution for quality level
262
+ * @param quality - Quality level: 'draft', 'normal', 'high'
263
+ * @returns Recommended DPI
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * const dpi = manager.getRecommendedResolution('high');
268
+ * // Returns 300 DPI for high quality
269
+ * ```
270
+ */
271
+ getRecommendedResolution(quality: 'draft' | 'normal' | 'high'): number;
272
+ /**
273
+ * Gets rendering statistics
274
+ * @returns Statistics { totalFonts, totalImages, avgPageSize, colorSpaceCount }
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * const stats = manager.getRenderingStatistics();
279
+ * console.log(`Total fonts: ${stats.totalFonts}`);
280
+ * ```
281
+ */
282
+ getRenderingStatistics(): RenderingStatistics;
283
+ /**
284
+ * Checks if page can be rendered
285
+ * @param pageIndex - Zero-based page index
286
+ * @returns True if page can be rendered
287
+ */
288
+ canRenderPage(pageIndex: number): boolean;
289
+ /**
290
+ * Validates rendering state
291
+ * @returns Validation result { isValid, issues }
292
+ */
293
+ validateRenderingState(): {
294
+ isValid: boolean;
295
+ issues: string[];
296
+ };
297
+ /**
298
+ * Renders a page to PNG or JPEG image file
299
+ * @param pageIndex - Zero-based page index
300
+ * @param outputPath - Path to output file (.png or .jpg)
301
+ * @param options - Rendering options
302
+ * @returns Absolute path to rendered file
303
+ * @throws Error if page index is invalid or rendering fails
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * const path = await manager.renderPageToFile(0, 'page.png', {
308
+ * dpi: 300,
309
+ * format: 'png'
310
+ * });
311
+ * console.log(`Rendered to ${path}`);
312
+ * ```
313
+ */
314
+ renderPageToFile(pageIndex: number, outputPath: string, options?: RenderOptions | RenderOptionsConfig | null): Promise<string>;
315
+ /**
316
+ * Renders a page to image bytes (PNG or JPEG)
317
+ * @param pageIndex - Zero-based page index
318
+ * @param options - Rendering options
319
+ * @returns Image data as Buffer
320
+ * @throws Error if page index is invalid or rendering fails
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * const imageBuffer = await manager.renderPageToBytes(0, {
325
+ * dpi: 150,
326
+ * format: 'jpeg',
327
+ * quality: 90
328
+ * });
329
+ * // Send to HTTP response, save to file, etc.
330
+ * ```
331
+ */
332
+ renderPageToBytes(pageIndex: number, options?: RenderOptions | RenderOptionsConfig | null): Promise<Buffer>;
333
+ /**
334
+ * Renders a range of pages to separate image files
335
+ * @param startPage - Starting page index (inclusive)
336
+ * @param endPage - Ending page index (inclusive)
337
+ * @param outputDir - Directory for output files
338
+ * @param namePattern - Filename pattern with placeholder
339
+ * @param options - Rendering options
340
+ * @returns Array of absolute paths to rendered files
341
+ * @throws Error if page range is invalid or rendering fails
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * const files = await manager.renderPagesRange(0, 10, './output', 'page_{:04d}.png', {
346
+ * dpi: 300,
347
+ * format: 'png'
348
+ * });
349
+ * console.log(`Rendered ${files.length} pages`);
350
+ * ```
351
+ */
352
+ renderPagesRange(startPage: number, endPage: number, outputDir: string, namePattern?: string, options?: RenderOptions | RenderOptionsConfig | null): Promise<string[]>;
353
+ }