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,64 @@
1
+ /**
2
+ * PDF Oxide Managers - Specialized facades for domain-specific operations
3
+ *
4
+ * This module provides manager classes that encapsulate domain-specific
5
+ * operations on PDF documents, offering a cleaner and more organized API
6
+ * compared to working directly with documents and pages.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import {
11
+ * OutlineManager,
12
+ * MetadataManager,
13
+ * ExtractionManager,
14
+ * SearchManager,
15
+ * SecurityManager,
16
+ * AnnotationManager,
17
+ * LayerManager,
18
+ * RenderingManager,
19
+ * } from 'pdf_oxide';
20
+ *
21
+ * const doc = PdfDocument.open('document.pdf');
22
+ *
23
+ * // Metadata operations
24
+ * const metadataManager = new MetadataManager(doc);
25
+ * console.log(metadataManager.getTitle());
26
+ *
27
+ * // Text extraction
28
+ * const extractionManager = new ExtractionManager(doc);
29
+ * const text = extractionManager.extractAllText();
30
+ *
31
+ * // Search operations
32
+ * const searchManager = new SearchManager(doc);
33
+ * const results = searchManager.searchAll('keyword');
34
+ *
35
+ * // Page annotations
36
+ * const page = doc.getPage(0);
37
+ * const annotationManager = new AnnotationManager(page);
38
+ * const highlights = annotationManager.getHighlights();
39
+ * ```
40
+ */
41
+ export { FieldVisibility, type FormField, type FormFieldConfig, FormFieldManager, FormFieldType, } from '../form-field-manager.js';
42
+ export { type AnnotationProperties, type FontProperties, type ImageProperties, ResultAccessorsManager, type SearchResultProperties, } from '../result-accessors-manager.js';
43
+ export { AccessibilityManager, type AutoTagResult, type StructureElement, type StructureTree, } from './accessibility-manager.js';
44
+ export { type Annotation, AnnotationManager, type AnnotationStatistics, type AnnotationValidation, } from './annotation-manager.js';
45
+ export { BarcodeErrorCorrection, BarcodeFormat, type BarcodeGenerationConfig, BarcodeManager, type DetectedBarcode, QrErrorCorrection, } from './barcode-manager.js';
46
+ export { type BatchDocument, BatchManager, type BatchOptions, type BatchProgress, type BatchResult, type BatchStatistics, } from './batch-manager.js';
47
+ export { CacheManager, type CacheStatistics as CacheStats, } from './cache-manager.js';
48
+ export { type ComplianceIssue, ComplianceIssueType, ComplianceManager, type ComplianceValidationResult, IssueSeverity, PdfALevel, PdfUALevel, PdfXLevel, } from './compliance-manager.js';
49
+ export { type ContentAnalysis, ContentManager, } from './content-manager.js';
50
+ export { type ApplyRedactionsOptions, EditingManager, type RedactionRect, type RgbColor, type ScrubMetadataOptions, } from './editing-manager.js';
51
+ export { BatesPosition, type Difference, DifferenceType, type DocumentComparisonResult, EnterpriseManager, type PageComparisonResult, StampAlignment, } from './enterprise-manager.js';
52
+ export { type ContentStatistics, ExtractionManager, type SearchMatch, } from './extraction-manager.js';
53
+ export { type Layer, type LayerHierarchy, LayerManager, type LayerStatistics, type LayerValidation, } from './layer-manager.js';
54
+ export { type MetadataComparison, MetadataManager, type ValidationResult, } from './metadata-manager.js';
55
+ export { OCRManager, type OcrConfig, OcrDetectionMode, OcrManager, type OcrPageAnalysis, type OcrSpan, } from './ocr-manager.js';
56
+ export { OptimizationManager, type OptimizationResult, } from './optimization-manager.js';
57
+ export { type OutlineItem, OutlineManager } from './outline-manager.js';
58
+ export { type PageInfo, PageManager, type PageRange, type PageStatistics, } from './page-manager.js';
59
+ export { type PageBox, type PageDimensions, type PageResources, RenderingManager, type RenderingStatistics, RenderOptions, type RenderOptionsConfig, } from './rendering-manager.js';
60
+ export { type SearchCapabilities, SearchManager, type SearchResult, type SearchStatistics, } from './search-manager.js';
61
+ export { type AccessibilityValidation, type PermissionsSummary, type SecurityLevel, SecurityManager, } from './security-manager.js';
62
+ export { type Certificate, type CertificateChain, CertificateFormat, type CertificateInfo, CertificationPermission, DigestAlgorithm, type DigitalSignature, FfiDigestAlgorithm, FfiSignatureSubFilter, type LoadedCertificate, type Signature, SignatureAlgorithm, type SignatureAppearance, type SignatureConfig, type SignatureField, type SignatureFieldConfig, SignatureManager, SignatureType, type SignatureValidationResult, type SigningCredentials, type SigningOptions, type SigningResult, type SignOptions, type TimestampConfig, type TimestampResult, TimestampStatus, } from './signature-manager.js';
63
+ export { createExtractionStream, createMetadataStream, createSearchStream, type ExtractionProgressData, ExtractionStream, MetadataStream, type PageMetadataData, type SearchResultData, SearchStream, } from './streams.js';
64
+ export { XFAManager, XfaBindingType, type XfaCreationResult, type XfaDataOptions, type XfaDataset, type XfaField, type XfaFieldConfig, type XfaFieldHandle, XfaFieldType, XfaFormType, XfaManager, type XfaScriptConfig, type XfaSubformConfig, type XfaTemplateConfig, XfaValidationType, } from './xfa-manager.js';
@@ -0,0 +1,69 @@
1
+ /**
2
+ * PDF Oxide Managers - Specialized facades for domain-specific operations
3
+ *
4
+ * This module provides manager classes that encapsulate domain-specific
5
+ * operations on PDF documents, offering a cleaner and more organized API
6
+ * compared to working directly with documents and pages.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import {
11
+ * OutlineManager,
12
+ * MetadataManager,
13
+ * ExtractionManager,
14
+ * SearchManager,
15
+ * SecurityManager,
16
+ * AnnotationManager,
17
+ * LayerManager,
18
+ * RenderingManager,
19
+ * } from 'pdf_oxide';
20
+ *
21
+ * const doc = PdfDocument.open('document.pdf');
22
+ *
23
+ * // Metadata operations
24
+ * const metadataManager = new MetadataManager(doc);
25
+ * console.log(metadataManager.getTitle());
26
+ *
27
+ * // Text extraction
28
+ * const extractionManager = new ExtractionManager(doc);
29
+ * const text = extractionManager.extractAllText();
30
+ *
31
+ * // Search operations
32
+ * const searchManager = new SearchManager(doc);
33
+ * const results = searchManager.searchAll('keyword');
34
+ *
35
+ * // Page annotations
36
+ * const page = doc.getPage(0);
37
+ * const annotationManager = new AnnotationManager(page);
38
+ * const highlights = annotationManager.getHighlights();
39
+ * ```
40
+ */
41
+ export { FieldVisibility, FormFieldManager, FormFieldType, } from '../form-field-manager.js';
42
+ // Phase 1 Expansion: Result Accessors and Forms
43
+ export { ResultAccessorsManager, } from '../result-accessors-manager.js';
44
+ export { AccessibilityManager, } from './accessibility-manager.js';
45
+ export { AnnotationManager, } from './annotation-manager.js';
46
+ export { BarcodeErrorCorrection, BarcodeFormat, BarcodeManager, QrErrorCorrection, } from './barcode-manager.js';
47
+ // Phase 2.5: Batch Processing API
48
+ export { BatchManager, } from './batch-manager.js';
49
+ export { CacheManager, } from './cache-manager.js';
50
+ export { ComplianceIssueType, ComplianceManager, IssueSeverity, PdfALevel, PdfUALevel, PdfXLevel, } from './compliance-manager.js';
51
+ export { ContentManager, } from './content-manager.js';
52
+ export { EditingManager, } from './editing-manager.js';
53
+ export { BatesPosition, DifferenceType, EnterpriseManager, StampAlignment, } from './enterprise-manager.js';
54
+ export { ExtractionManager, } from './extraction-manager.js';
55
+ export { LayerManager, } from './layer-manager.js';
56
+ export { MetadataManager, } from './metadata-manager.js';
57
+ // Canonical Managers (Phase 9 consolidation)
58
+ export { OCRManager, OcrDetectionMode, OcrManager, } from './ocr-manager.js';
59
+ export { OptimizationManager, } from './optimization-manager.js';
60
+ // Core Managers
61
+ export { OutlineManager } from './outline-manager.js';
62
+ export { PageManager, } from './page-manager.js';
63
+ export { RenderingManager, RenderOptions, } from './rendering-manager.js';
64
+ export { SearchManager, } from './search-manager.js';
65
+ export { SecurityManager, } from './security-manager.js';
66
+ export { CertificateFormat, CertificationPermission, DigestAlgorithm, FfiDigestAlgorithm, FfiSignatureSubFilter, SignatureAlgorithm, SignatureManager, SignatureType, TimestampStatus, } from './signature-manager.js';
67
+ // Phase 2.4: Stream API support
68
+ export { createExtractionStream, createMetadataStream, createSearchStream, ExtractionStream, MetadataStream, SearchStream, } from './streams.js';
69
+ export { XFAManager, XfaBindingType, XfaFieldType, XfaFormType, XfaManager, XfaValidationType, } from './xfa-manager.js';
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Manager for PDF layers (Optional Content Groups - OCG)
3
+ *
4
+ * Provides methods to manage and interact with PDF layers which are used
5
+ * for optional content groups in PDF documents.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { LayerManager } from 'pdf_oxide';
10
+ *
11
+ * const doc = PdfDocument.open('document.pdf');
12
+ * const layerManager = new LayerManager(doc);
13
+ *
14
+ * // Check if document has layers
15
+ * if (layerManager.hasLayers()) {
16
+ * const layers = layerManager.getLayers();
17
+ * console.log(`Document has ${layers.length} layers`);
18
+ * }
19
+ * ```
20
+ */
21
+ export interface Layer {
22
+ id: string;
23
+ name: string;
24
+ visible: boolean;
25
+ index: number;
26
+ parentId: string | null;
27
+ printable: boolean;
28
+ export: boolean;
29
+ description?: string;
30
+ dependsOn?: string[];
31
+ }
32
+ export interface LayerNode extends Layer {
33
+ children: LayerNode[];
34
+ }
35
+ export interface LayerHierarchy {
36
+ root: LayerNode[];
37
+ }
38
+ export interface LayerStatistics {
39
+ count: number;
40
+ rootCount: number;
41
+ maxDepth: number;
42
+ visible: number;
43
+ hidden: number;
44
+ printable: number;
45
+ exportable: number;
46
+ hasConflicts: boolean;
47
+ }
48
+ export interface LayerValidation {
49
+ isValid: boolean;
50
+ issues: string[];
51
+ }
52
+ export declare class LayerManager {
53
+ private _document;
54
+ private _layerCache;
55
+ private _hierarchyCache;
56
+ private _statisticsCache;
57
+ /**
58
+ * Creates a new LayerManager for the given document
59
+ * @param document - The PDF document
60
+ * @throws Error if document is null or undefined
61
+ */
62
+ constructor(document: any);
63
+ /**
64
+ * Clears the layer cache
65
+ * Useful when document content might have changed
66
+ */
67
+ clearCache(): void;
68
+ /**
69
+ * Checks if document has layers
70
+ * @returns True if document contains layers
71
+ */
72
+ hasLayers(): boolean;
73
+ /**
74
+ * Gets number of layers in document
75
+ * @returns Number of layers
76
+ */
77
+ getLayerCount(): number;
78
+ /**
79
+ * Gets all layers in document
80
+ * @returns Array of layer objects with id, name, visible, etc.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const layers = manager.getLayers();
85
+ * layers.forEach(layer => {
86
+ * console.log(`Layer: ${layer.name} (visible: ${layer.visible})`);
87
+ * });
88
+ * ```
89
+ */
90
+ getLayers(): Layer[];
91
+ /**
92
+ * Gets layer by name
93
+ * @param name - Layer name to find
94
+ * @returns Layer object or null if not found
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const layer = manager.getLayerByName('Background');
99
+ * if (layer) {
100
+ * console.log(`Found layer: ${layer.name}`);
101
+ * }
102
+ * ```
103
+ */
104
+ getLayerByName(name: string): Layer | null;
105
+ /**
106
+ * Gets layer by ID
107
+ * @param id - Layer ID to find
108
+ * @returns Layer object or null if not found
109
+ */
110
+ getLayerById(id: string): Layer | null;
111
+ /**
112
+ * Gets root-level layers (not nested under other layers)
113
+ * @returns Array of root-level layers
114
+ */
115
+ getRootLayers(): Layer[];
116
+ /**
117
+ * Gets the full layer hierarchy as a tree structure
118
+ * @returns Layer hierarchy tree
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const hierarchy = manager.getLayerHierarchy();
123
+ * // { root: [{ name: 'Layer1', children: [...] }, ...] }
124
+ * ```
125
+ */
126
+ getLayerHierarchy(): LayerHierarchy;
127
+ /**
128
+ * Gets child layers of a parent layer
129
+ * @param parentId - Parent layer ID
130
+ * @returns Array of child layers
131
+ */
132
+ getChildLayers(parentId: string): Layer[];
133
+ /**
134
+ * Gets parent layer of a layer
135
+ * @param layerId - Layer ID
136
+ * @returns Parent layer object or null if no parent
137
+ */
138
+ getParentLayer(layerId: string): Layer | null;
139
+ /**
140
+ * Checks if a layer is visible
141
+ * @param layerId - Layer ID
142
+ * @returns True if layer is visible
143
+ */
144
+ isLayerVisible(layerId: string): boolean;
145
+ /**
146
+ * Gets visibility chain from root to layer
147
+ * Shows visibility state of all parent layers
148
+ * @param layerId - Layer ID
149
+ * @returns Array of layers from root to target
150
+ */
151
+ getVisibilityChain(layerId: string): Layer[];
152
+ /**
153
+ * Gets layer usage information
154
+ * @returns Layer usage { view, print, export }
155
+ */
156
+ getLayerUsages(): Record<string, number>;
157
+ /**
158
+ * Gets statistics about layers
159
+ * @returns Layer statistics
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * const stats = manager.getLayerStatistics();
164
+ * console.log(`Total layers: ${stats.count}`);
165
+ * console.log(`Max depth: ${stats.maxDepth}`);
166
+ * ```
167
+ */
168
+ getLayerStatistics(): LayerStatistics;
169
+ /**
170
+ * Gets layer dependencies
171
+ * @returns Layer dependencies map
172
+ * @private
173
+ */
174
+ private getLayerDependencies;
175
+ /**
176
+ * Finds layers by pattern
177
+ * @param pattern - Pattern to match
178
+ * @returns Matching layers
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * const backgroundLayers = manager.findLayersByPattern(/background/i);
183
+ * ```
184
+ */
185
+ findLayersByPattern(pattern: RegExp | string): Layer[];
186
+ /**
187
+ * Validates layer state for conflicts and issues
188
+ * @returns Validation result { isValid, issues }
189
+ */
190
+ validateLayerState(): LayerValidation;
191
+ /**
192
+ * Detects layer conflicts
193
+ * @returns Array of conflict descriptions
194
+ * @private
195
+ */
196
+ private _detectLayerConflicts;
197
+ /**
198
+ * Detects cycles in layer hierarchy
199
+ * @returns Array of cycle descriptions
200
+ * @private
201
+ */
202
+ private _detectLayerCycles;
203
+ }