pdf-lite 1.3.3 → 1.5.0
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/dist/acroform/acroform.d.ts +7 -454
- package/dist/acroform/acroform.js +5 -1664
- package/dist/acroform/appearance/index.d.ts +4 -0
- package/dist/acroform/appearance/index.js +4 -0
- package/dist/acroform/appearance/pdf-appearance-stream.d.ts +21 -0
- package/dist/acroform/appearance/pdf-appearance-stream.js +41 -0
- package/dist/acroform/appearance/pdf-button-appearance-stream.d.ts +13 -0
- package/dist/acroform/appearance/pdf-button-appearance-stream.js +54 -0
- package/dist/acroform/appearance/pdf-choice-appearance-stream.d.ts +22 -0
- package/dist/acroform/appearance/pdf-choice-appearance-stream.js +75 -0
- package/dist/acroform/appearance/pdf-graphics.d.ts +51 -0
- package/dist/acroform/appearance/pdf-graphics.js +239 -0
- package/dist/acroform/appearance/pdf-text-appearance-stream.d.ts +22 -0
- package/dist/acroform/appearance/pdf-text-appearance-stream.js +104 -0
- package/dist/acroform/fields/index.d.ts +8 -0
- package/dist/acroform/fields/index.js +8 -0
- package/dist/acroform/fields/pdf-button-form-field.d.ts +23 -0
- package/dist/acroform/fields/pdf-button-form-field.js +102 -0
- package/dist/acroform/fields/pdf-choice-form-field.d.ts +18 -0
- package/dist/acroform/fields/pdf-choice-form-field.js +131 -0
- package/dist/acroform/fields/pdf-default-appearance.d.ts +23 -0
- package/dist/acroform/fields/pdf-default-appearance.js +68 -0
- package/dist/acroform/fields/pdf-form-field-flags.d.ts +45 -0
- package/dist/acroform/fields/pdf-form-field-flags.js +122 -0
- package/dist/acroform/fields/pdf-form-field.d.ts +123 -0
- package/dist/acroform/fields/pdf-form-field.js +433 -0
- package/dist/acroform/fields/pdf-signature-form-field.d.ts +7 -0
- package/dist/acroform/fields/pdf-signature-form-field.js +12 -0
- package/dist/acroform/fields/pdf-text-form-field.d.ts +10 -0
- package/dist/acroform/fields/pdf-text-form-field.js +77 -0
- package/dist/acroform/fields/types.d.ts +26 -0
- package/dist/acroform/fields/types.js +9 -0
- package/dist/acroform/index.d.ts +5 -1
- package/dist/acroform/index.js +5 -1
- package/dist/acroform/manager.d.ts +12 -1
- package/dist/acroform/manager.js +20 -2
- package/dist/acroform/pdf-acro-form.d.ts +69 -0
- package/dist/acroform/pdf-acro-form.js +293 -0
- package/dist/acroform/pdf-font-encoding-cache.d.ts +27 -0
- package/dist/acroform/pdf-font-encoding-cache.js +188 -0
- package/dist/acroform/xfa/index.d.ts +3 -0
- package/dist/acroform/xfa/index.js +2 -0
- package/dist/acroform/xfa/pdf-xfa-data.d.ts +20 -0
- package/dist/acroform/xfa/pdf-xfa-data.js +68 -0
- package/dist/acroform/xfa/pdf-xfa-form.d.ts +11 -0
- package/dist/acroform/xfa/pdf-xfa-form.js +56 -0
- package/dist/annotations/index.d.ts +4 -0
- package/dist/annotations/index.js +4 -0
- package/dist/annotations/pdf-annotation-flags.d.ts +24 -0
- package/dist/annotations/pdf-annotation-flags.js +93 -0
- package/dist/annotations/pdf-annotation-writer.d.ts +20 -0
- package/dist/annotations/pdf-annotation-writer.js +76 -0
- package/dist/annotations/pdf-annotation.d.ts +61 -0
- package/dist/annotations/pdf-annotation.js +106 -0
- package/dist/annotations/pdf-widget-annotation.d.ts +15 -0
- package/dist/annotations/pdf-widget-annotation.js +37 -0
- package/dist/core/objects/pdf-array.d.ts +1 -1
- package/dist/core/objects/pdf-array.js +3 -2
- package/dist/core/objects/pdf-boolean.d.ts +1 -1
- package/dist/core/objects/pdf-boolean.js +3 -2
- package/dist/core/objects/pdf-comment.d.ts +1 -1
- package/dist/core/objects/pdf-comment.js +1 -1
- package/dist/core/objects/pdf-dictionary.d.ts +1 -1
- package/dist/core/objects/pdf-dictionary.js +3 -2
- package/dist/core/objects/pdf-hexadecimal.d.ts +1 -1
- package/dist/core/objects/pdf-hexadecimal.js +3 -2
- package/dist/core/objects/pdf-indirect-object.d.ts +1 -1
- package/dist/core/objects/pdf-indirect-object.js +1 -1
- package/dist/core/objects/pdf-name.d.ts +1 -1
- package/dist/core/objects/pdf-name.js +3 -2
- package/dist/core/objects/pdf-null.d.ts +1 -1
- package/dist/core/objects/pdf-null.js +3 -2
- package/dist/core/objects/pdf-number.d.ts +1 -1
- package/dist/core/objects/pdf-number.js +3 -2
- package/dist/core/objects/pdf-object-reference.d.ts +1 -1
- package/dist/core/objects/pdf-object-reference.js +3 -2
- package/dist/core/objects/pdf-object.d.ts +3 -1
- package/dist/core/objects/pdf-object.js +6 -0
- package/dist/core/objects/pdf-start-xref.d.ts +1 -1
- package/dist/core/objects/pdf-start-xref.js +3 -2
- package/dist/core/objects/pdf-stream.d.ts +4 -3
- package/dist/core/objects/pdf-stream.js +45 -16
- package/dist/core/objects/pdf-string.d.ts +2 -1
- package/dist/core/objects/pdf-string.js +17 -2
- package/dist/core/objects/pdf-trailer.d.ts +1 -1
- package/dist/core/objects/pdf-trailer.js +3 -2
- package/dist/core/objects/pdf-xref-table.d.ts +3 -3
- package/dist/core/objects/pdf-xref-table.js +3 -3
- package/dist/core/parser/incremental-parser.d.ts +0 -13
- package/dist/core/parser/incremental-parser.js +1 -18
- package/dist/core/streams/object-stream.d.ts +1 -1
- package/dist/core/streams/object-stream.js +1 -1
- package/dist/errors.d.ts +22 -0
- package/dist/errors.js +24 -0
- package/dist/fonts/index.d.ts +1 -1
- package/dist/fonts/index.js +1 -1
- package/dist/fonts/pdf-font.d.ts +64 -7
- package/dist/fonts/pdf-font.js +188 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/pdf/index.d.ts +0 -1
- package/dist/pdf/index.js +0 -1
- package/dist/pdf/pdf-document.d.ts +16 -12
- package/dist/pdf/pdf-document.js +51 -37
- package/dist/pdf/pdf-revision.d.ts +1 -1
- package/dist/pdf/pdf-revision.js +1 -1
- package/dist/pdf/pdf-xref-lookup.d.ts +8 -0
- package/dist/pdf/pdf-xref-lookup.js +12 -0
- package/dist/security/handlers/base.js +3 -0
- package/dist/utils/encodePdfText.d.ts +17 -0
- package/dist/utils/encodePdfText.js +61 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/pdf/errors.d.ts +0 -6
- package/dist/pdf/errors.js +0 -6
- package/dist/xfa/index.d.ts +0 -1
- package/dist/xfa/index.js +0 -1
- package/dist/xfa/manager.d.ts +0 -44
- package/dist/xfa/manager.js +0 -136
- /package/dist/fonts/{font-manager.d.ts → manager.d.ts} +0 -0
- /package/dist/fonts/{font-manager.js → manager.js} +0 -0
- /package/dist/utils/{IterableReadableStream.d.ts → iterable-readable-stream.d.ts} +0 -0
- /package/dist/utils/{IterableReadableStream.js → iterable-readable-stream.js} +0 -0
|
@@ -1,456 +1,9 @@
|
|
|
1
|
-
import { PdfDocument } from '../pdf/pdf-document.js';
|
|
2
|
-
import { PdfDictionary } from '../core/objects/pdf-dictionary.js';
|
|
3
|
-
import { PdfArray } from '../core/objects/pdf-array.js';
|
|
4
|
-
import { PdfString } from '../core/objects/pdf-string.js';
|
|
5
|
-
import { PdfObjectReference } from '../core/objects/pdf-object-reference.js';
|
|
6
|
-
import { PdfIndirectObject } from '../core/objects/pdf-indirect-object.js';
|
|
7
|
-
import { PdfName } from '../core/objects/pdf-name.js';
|
|
8
|
-
import { PdfBoolean } from '../core/objects/pdf-boolean.js';
|
|
9
|
-
import { PdfNumber } from '../core/objects/pdf-number.js';
|
|
10
|
-
import { PdfFont } from '../fonts/pdf-font.js';
|
|
11
|
-
import { PdfStream } from '../core/objects/pdf-stream.js';
|
|
12
1
|
/**
|
|
13
|
-
*
|
|
2
|
+
* Backward-compatible re-export shim.
|
|
3
|
+
* All classes have been moved to dedicated modules.
|
|
14
4
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
export type PdfFieldType = keyof typeof PdfFieldType;
|
|
22
|
-
export type PdfAppearanceStreamDictionary = PdfDictionary<{
|
|
23
|
-
/** Appearance streams for different states */
|
|
24
|
-
N: PdfObjectReference | PdfDictionary;
|
|
25
|
-
R?: PdfObjectReference | PdfDictionary;
|
|
26
|
-
D?: PdfObjectReference | PdfDictionary;
|
|
27
|
-
}>;
|
|
28
|
-
export type PdfDefaultResourcesDictionary = PdfDictionary<{
|
|
29
|
-
/** Font resources used in the form */
|
|
30
|
-
Font?: PdfDictionary;
|
|
31
|
-
/** Procedure sets */
|
|
32
|
-
ProcSet?: PdfArray;
|
|
33
|
-
/** Extended graphics states */
|
|
34
|
-
ExtGState?: PdfDictionary;
|
|
35
|
-
/** Color spaces */
|
|
36
|
-
ColorSpace?: PdfDictionary;
|
|
37
|
-
/** Patterns */
|
|
38
|
-
Pattern?: PdfDictionary;
|
|
39
|
-
/** Shading dictionaries */
|
|
40
|
-
Shading?: PdfDictionary;
|
|
41
|
-
/** External objects */
|
|
42
|
-
XObject?: PdfDictionary;
|
|
43
|
-
}>;
|
|
44
|
-
export declare class PdfAcroFormField extends PdfIndirectObject<PdfDictionary<{
|
|
45
|
-
FT: PdfName<(typeof PdfFieldType)[keyof typeof PdfFieldType]>;
|
|
46
|
-
T?: PdfString;
|
|
47
|
-
V?: PdfString | PdfName;
|
|
48
|
-
DV?: PdfString | PdfName;
|
|
49
|
-
DA?: PdfString;
|
|
50
|
-
AS?: PdfName;
|
|
51
|
-
Kids?: PdfArray<PdfObjectReference>;
|
|
52
|
-
P?: PdfObjectReference;
|
|
53
|
-
Rect?: PdfArray<PdfNumber>;
|
|
54
|
-
F?: PdfNumber;
|
|
55
|
-
Ff?: PdfNumber;
|
|
56
|
-
BS?: PdfDictionary;
|
|
57
|
-
MK?: PdfDictionary;
|
|
58
|
-
Type?: PdfName<'Annot'>;
|
|
59
|
-
Subtype?: PdfName<'Widget'>;
|
|
60
|
-
AP?: PdfAppearanceStreamDictionary;
|
|
61
|
-
Q?: PdfNumber;
|
|
62
|
-
MaxLen?: PdfNumber;
|
|
63
|
-
Opt?: PdfArray<PdfString>;
|
|
64
|
-
}>> {
|
|
65
|
-
private _parent?;
|
|
66
|
-
defaultGenerateAppearance: boolean;
|
|
67
|
-
private _appearanceStream?;
|
|
68
|
-
private _appearanceStreamYes?;
|
|
69
|
-
private form?;
|
|
70
|
-
constructor(options?: {
|
|
71
|
-
other?: PdfIndirectObject;
|
|
72
|
-
form?: PdfAcroForm;
|
|
73
|
-
});
|
|
74
|
-
get parent(): PdfAcroFormField | undefined;
|
|
75
|
-
set parent(field: PdfAcroFormField | undefined);
|
|
76
|
-
get children(): PdfAcroFormField[];
|
|
77
|
-
set children(fields: PdfAcroFormField[]);
|
|
78
|
-
get siblings(): PdfAcroFormField[];
|
|
79
|
-
get encodingMap(): Map<number, string> | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Convenience method to check if field dictionary is modified
|
|
82
|
-
*/
|
|
83
|
-
isModified(): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Gets the field type
|
|
86
|
-
*/
|
|
87
|
-
get fieldType(): PdfFieldType | null;
|
|
88
|
-
set fieldType(type: PdfFieldType | null);
|
|
89
|
-
get rect(): number[] | null;
|
|
90
|
-
set rect(rect: number[] | null);
|
|
91
|
-
get parentRef(): PdfObjectReference | null;
|
|
92
|
-
set parentRef(ref: PdfObjectReference | null);
|
|
93
|
-
get isWidget(): boolean;
|
|
94
|
-
set isWidget(isWidget: boolean);
|
|
95
|
-
/**
|
|
96
|
-
* Gets the field name
|
|
97
|
-
*/
|
|
98
|
-
get name(): string;
|
|
99
|
-
/**
|
|
100
|
-
* Sets the field name
|
|
101
|
-
*/
|
|
102
|
-
set name(name: string);
|
|
103
|
-
/**
|
|
104
|
-
* Gets the default value
|
|
105
|
-
*/
|
|
106
|
-
get defaultValue(): string;
|
|
107
|
-
/**
|
|
108
|
-
* Sets the default value
|
|
109
|
-
*/
|
|
110
|
-
set defaultValue(val: string);
|
|
111
|
-
get value(): string;
|
|
112
|
-
set value(val: string | PdfString);
|
|
113
|
-
get checked(): boolean;
|
|
114
|
-
set checked(isChecked: boolean);
|
|
115
|
-
get fontSize(): number | null;
|
|
116
|
-
set fontSize(size: number);
|
|
117
|
-
get fontName(): string | null;
|
|
118
|
-
set fontName(fontName: string);
|
|
119
|
-
/**
|
|
120
|
-
* Sets the font using a PdfFont object.
|
|
121
|
-
* Pass null to clear the font.
|
|
122
|
-
*/
|
|
123
|
-
set font(font: PdfFont | null);
|
|
124
|
-
/**
|
|
125
|
-
* Gets field flags (bitwise combination of field attributes)
|
|
126
|
-
*/
|
|
127
|
-
get flags(): number;
|
|
128
|
-
/**
|
|
129
|
-
* Sets field flags
|
|
130
|
-
*/
|
|
131
|
-
set flags(flags: number);
|
|
132
|
-
/**
|
|
133
|
-
* Gets annotation flags (for visual appearance and behavior)
|
|
134
|
-
*/
|
|
135
|
-
get annotationFlags(): number;
|
|
136
|
-
/**
|
|
137
|
-
* Sets annotation flags
|
|
138
|
-
*/
|
|
139
|
-
set annotationFlags(flags: number);
|
|
140
|
-
/**
|
|
141
|
-
* Checks if the field is read-only (Ff bit 1)
|
|
142
|
-
*/
|
|
143
|
-
get readOnly(): boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Sets the field as read-only or editable (Ff bit 1)
|
|
146
|
-
*/
|
|
147
|
-
set readOnly(isReadOnly: boolean);
|
|
148
|
-
/**
|
|
149
|
-
* Checks if the field is required
|
|
150
|
-
*/
|
|
151
|
-
get required(): boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Sets the field as required or optional
|
|
154
|
-
*/
|
|
155
|
-
set required(isRequired: boolean);
|
|
156
|
-
/**
|
|
157
|
-
* Checks if the field is multiline (for text fields)
|
|
158
|
-
*/
|
|
159
|
-
get multiline(): boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Sets the field as multiline (for text fields)
|
|
162
|
-
*/
|
|
163
|
-
set multiline(isMultiline: boolean);
|
|
164
|
-
/**
|
|
165
|
-
* Checks if the field is a password field (for text fields)
|
|
166
|
-
*/
|
|
167
|
-
get password(): boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Sets the field as a password field (for text fields)
|
|
170
|
-
*/
|
|
171
|
-
set password(isPassword: boolean);
|
|
172
|
-
/**
|
|
173
|
-
* Checks if the field is a comb field (characters distributed evenly across cells)
|
|
174
|
-
*/
|
|
175
|
-
get comb(): boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Gets the quadding (text alignment) for this field.
|
|
178
|
-
* 0 = left-justified, 1 = centered, 2 = right-justified
|
|
179
|
-
*/
|
|
180
|
-
get quadding(): number;
|
|
181
|
-
/**
|
|
182
|
-
* Sets the quadding (text alignment) for this field.
|
|
183
|
-
* 0 = left-justified, 1 = centered, 2 = right-justified
|
|
184
|
-
*/
|
|
185
|
-
set quadding(q: number);
|
|
186
|
-
/**
|
|
187
|
-
* Gets the options for choice fields (dropdowns, list boxes).
|
|
188
|
-
* Returns an array of option strings.
|
|
189
|
-
*/
|
|
190
|
-
get options(): string[];
|
|
191
|
-
/**
|
|
192
|
-
* Sets the options for choice fields (dropdowns, list boxes).
|
|
193
|
-
* Pass an array of strings.
|
|
194
|
-
*/
|
|
195
|
-
set options(options: string[]);
|
|
196
|
-
get defaultAppearance(): string | null;
|
|
197
|
-
set defaultAppearance(da: string);
|
|
198
|
-
set combo(isCombo: boolean);
|
|
199
|
-
get combo(): boolean;
|
|
200
|
-
get radio(): boolean;
|
|
201
|
-
set radio(isRadio: boolean);
|
|
202
|
-
get noToggleToOff(): boolean;
|
|
203
|
-
set noToggleToOff(noToggle: boolean);
|
|
204
|
-
get combField(): boolean;
|
|
205
|
-
set combField(isComb: boolean);
|
|
206
|
-
get maxLen(): number | null;
|
|
207
|
-
set maxLen(maxLen: number | null);
|
|
208
|
-
/**
|
|
209
|
-
* If true, the annotation is invisible (F bit 1)
|
|
210
|
-
*/
|
|
211
|
-
get invisible(): boolean;
|
|
212
|
-
set invisible(value: boolean);
|
|
213
|
-
/**
|
|
214
|
-
* If true, the annotation is hidden (F bit 2)
|
|
215
|
-
*/
|
|
216
|
-
get hidden(): boolean;
|
|
217
|
-
set hidden(value: boolean);
|
|
218
|
-
/**
|
|
219
|
-
* If true, print the annotation when printing (F bit 3)
|
|
220
|
-
*/
|
|
221
|
-
get print(): boolean;
|
|
222
|
-
set print(value: boolean);
|
|
223
|
-
/**
|
|
224
|
-
* If true, do not zoom annotation when zooming (F bit 4)
|
|
225
|
-
*/
|
|
226
|
-
get noZoom(): boolean;
|
|
227
|
-
set noZoom(value: boolean);
|
|
228
|
-
/**
|
|
229
|
-
* If true, do not rotate annotation when rotating (F bit 5)
|
|
230
|
-
*/
|
|
231
|
-
get noRotate(): boolean;
|
|
232
|
-
set noRotate(value: boolean);
|
|
233
|
-
/**
|
|
234
|
-
* If true, do not display annotation on screen (F bit 6)
|
|
235
|
-
*/
|
|
236
|
-
get noView(): boolean;
|
|
237
|
-
set noView(value: boolean);
|
|
238
|
-
/**
|
|
239
|
-
* If true, annotation is locked (F bit 8)
|
|
240
|
-
*/
|
|
241
|
-
get locked(): boolean;
|
|
242
|
-
set locked(value: boolean);
|
|
243
|
-
/**
|
|
244
|
-
* If true, field value should not be exported (Ff bit 3)
|
|
245
|
-
*/
|
|
246
|
-
get noExport(): boolean;
|
|
247
|
-
set noExport(value: boolean);
|
|
248
|
-
/**
|
|
249
|
-
* If true, field is a pushbutton (Ff bit 17)
|
|
250
|
-
*/
|
|
251
|
-
get pushButton(): boolean;
|
|
252
|
-
set pushButton(value: boolean);
|
|
253
|
-
/**
|
|
254
|
-
* If true, text field allows editing (Ff bit 19)
|
|
255
|
-
*/
|
|
256
|
-
get edit(): boolean;
|
|
257
|
-
set edit(value: boolean);
|
|
258
|
-
/**
|
|
259
|
-
* If true, choice options should be sorted alphabetically (Ff bit 20)
|
|
260
|
-
*/
|
|
261
|
-
get sort(): boolean;
|
|
262
|
-
set sort(value: boolean);
|
|
263
|
-
/**
|
|
264
|
-
* If true, allows multiple selections in choice field (Ff bit 22)
|
|
265
|
-
*/
|
|
266
|
-
get multiSelect(): boolean;
|
|
267
|
-
set multiSelect(value: boolean);
|
|
268
|
-
/**
|
|
269
|
-
* If true, do not spell check this field (Ff bit 23)
|
|
270
|
-
*/
|
|
271
|
-
get doNotSpellCheck(): boolean;
|
|
272
|
-
set doNotSpellCheck(value: boolean);
|
|
273
|
-
/**
|
|
274
|
-
* If true, do not scroll text field (Ff bit 24)
|
|
275
|
-
*/
|
|
276
|
-
get doNotScroll(): boolean;
|
|
277
|
-
set doNotScroll(value: boolean);
|
|
278
|
-
/**
|
|
279
|
-
* If true, commit field value immediately on selection change (Ff bit 27)
|
|
280
|
-
*/
|
|
281
|
-
get commitOnSelChange(): boolean;
|
|
282
|
-
set commitOnSelChange(value: boolean);
|
|
283
|
-
get kids(): PdfObjectReference[];
|
|
284
|
-
set kids(kids: PdfObjectReference[]);
|
|
285
|
-
get appearanceStreamDict(): PdfAppearanceStreamDictionary | null;
|
|
286
|
-
set appearanceStreamDict(dict: PdfAppearanceStreamDictionary | null);
|
|
287
|
-
/**
|
|
288
|
-
* Generates an appearance stream for a text field using iText's approach.
|
|
289
|
-
*
|
|
290
|
-
* This generates an appearance with text using the same positioning formula as iText:
|
|
291
|
-
* - textY = (height - fontSize) / 2 + fontSize * 0.2
|
|
292
|
-
* - Wrapped in marked content blocks (/Tx BMC ... EMC)
|
|
293
|
-
* - Field remains editable unless makeReadOnly is set
|
|
294
|
-
*
|
|
295
|
-
* For editable fields (default, no options):
|
|
296
|
-
* - Text visible immediately
|
|
297
|
-
* - Field remains fully editable
|
|
298
|
-
* - No save dialog (needAppearances = false)
|
|
299
|
-
* - Text positioning matches iText
|
|
300
|
-
*
|
|
301
|
-
* For read-only fields (makeReadOnly: true):
|
|
302
|
-
* - Same appearance generation
|
|
303
|
-
* - Field is set as read-only
|
|
304
|
-
*
|
|
305
|
-
* @param options.makeReadOnly - If true, sets field as read-only
|
|
306
|
-
* @returns true if appearance was generated successfully
|
|
307
|
-
*/
|
|
308
|
-
generateAppearance(options?: {
|
|
309
|
-
makeReadOnly?: boolean;
|
|
310
|
-
textYOffset?: number;
|
|
311
|
-
}): boolean;
|
|
312
|
-
/**
|
|
313
|
-
* Generates appearance for text fields
|
|
314
|
-
* @internal
|
|
315
|
-
*/
|
|
316
|
-
private generateTextAppearance;
|
|
317
|
-
/**
|
|
318
|
-
* Generates appearance for button fields (checkboxes, radio buttons)
|
|
319
|
-
* @internal
|
|
320
|
-
*/
|
|
321
|
-
private generateButtonAppearance;
|
|
322
|
-
/**
|
|
323
|
-
* Generates appearance for choice fields (dropdowns, list boxes)
|
|
324
|
-
* @internal
|
|
325
|
-
*/
|
|
326
|
-
private generateChoiceAppearance;
|
|
327
|
-
/**
|
|
328
|
-
* Gets the stored appearance stream if one has been generated.
|
|
329
|
-
* For button fields, returns the appropriate stream based on the current state.
|
|
330
|
-
* @internal
|
|
331
|
-
*/
|
|
332
|
-
getAppearanceStream(): PdfStream | undefined;
|
|
333
|
-
/**
|
|
334
|
-
* Gets all appearance streams for writing to PDF.
|
|
335
|
-
* For button fields, returns both Off and Yes states.
|
|
336
|
-
* For other fields, returns just the primary appearance.
|
|
337
|
-
* @internal
|
|
338
|
-
*/
|
|
339
|
-
getAppearanceStreamsForWriting(): {
|
|
340
|
-
primary: PdfStream;
|
|
341
|
-
secondary?: PdfStream;
|
|
342
|
-
} | undefined;
|
|
343
|
-
/**
|
|
344
|
-
* Sets the appearance dictionary reference for this field.
|
|
345
|
-
* @internal - This is called automatically by PdfAcroForm.write()
|
|
346
|
-
*/
|
|
347
|
-
setAppearanceReference(appearanceStreamRef: PdfObjectReference, appearanceStreamYesRef?: PdfObjectReference): void;
|
|
348
|
-
}
|
|
349
|
-
export declare class PdfAcroForm<T extends Record<string, string> = Record<string, string>> extends PdfIndirectObject<PdfDictionary<{
|
|
350
|
-
Fields: PdfArray<PdfObjectReference>;
|
|
351
|
-
NeedAppearances?: PdfBoolean;
|
|
352
|
-
SigFlags?: PdfNumber;
|
|
353
|
-
CO?: PdfArray<PdfObjectReference>;
|
|
354
|
-
DR?: PdfDefaultResourcesDictionary;
|
|
355
|
-
DA?: PdfString;
|
|
356
|
-
Q?: PdfNumber;
|
|
357
|
-
}>> {
|
|
358
|
-
fields: PdfAcroFormField[];
|
|
359
|
-
readonly fontEncodingMaps: Map<string, Map<number, string>>;
|
|
360
|
-
private document?;
|
|
361
|
-
constructor(options?: {
|
|
362
|
-
other?: PdfIndirectObject;
|
|
363
|
-
fields?: PdfAcroFormField[];
|
|
364
|
-
document?: PdfDocument;
|
|
365
|
-
});
|
|
366
|
-
/**
|
|
367
|
-
* Convenience method to get a value from the form dictionary
|
|
368
|
-
*/
|
|
369
|
-
get(key: string): any;
|
|
370
|
-
/**
|
|
371
|
-
* Convenience method to set a value in the form dictionary
|
|
372
|
-
*/
|
|
373
|
-
set(key: string, value: any): void;
|
|
374
|
-
/**
|
|
375
|
-
* Convenience method to delete a key from the form dictionary
|
|
376
|
-
*/
|
|
377
|
-
delete(key: string): void;
|
|
378
|
-
/**
|
|
379
|
-
* Convenience method to check if form dictionary is modified
|
|
380
|
-
*/
|
|
381
|
-
isModified(): boolean;
|
|
382
|
-
/**
|
|
383
|
-
* Gets the NeedAppearances flag
|
|
384
|
-
*/
|
|
385
|
-
get needAppearances(): boolean;
|
|
386
|
-
/**
|
|
387
|
-
* Sets the NeedAppearances flag to indicate that appearance streams need to be regenerated
|
|
388
|
-
*/
|
|
389
|
-
set needAppearances(value: boolean);
|
|
390
|
-
/**
|
|
391
|
-
* Gets the signature flags
|
|
392
|
-
*/
|
|
393
|
-
get signatureFlags(): number;
|
|
394
|
-
/**
|
|
395
|
-
* Sets the signature flags
|
|
396
|
-
*/
|
|
397
|
-
set signatureFlags(flags: number);
|
|
398
|
-
/**
|
|
399
|
-
* Gets the default appearance string for the form
|
|
400
|
-
*/
|
|
401
|
-
get defaultAppearance(): string | null;
|
|
402
|
-
/**
|
|
403
|
-
* Sets the default appearance string for the form
|
|
404
|
-
*/
|
|
405
|
-
set defaultAppearance(da: string);
|
|
406
|
-
/**
|
|
407
|
-
* Gets the default quadding (alignment) for the form
|
|
408
|
-
* 0 = left, 1 = center, 2 = right
|
|
409
|
-
*/
|
|
410
|
-
get defaultQuadding(): number;
|
|
411
|
-
/**
|
|
412
|
-
* Sets the default quadding (alignment) for the form
|
|
413
|
-
*/
|
|
414
|
-
set defaultQuadding(q: number);
|
|
415
|
-
/**
|
|
416
|
-
* Gets the default resources dictionary for the form
|
|
417
|
-
*/
|
|
418
|
-
get defaultResources(): PdfDefaultResourcesDictionary | null;
|
|
419
|
-
/**
|
|
420
|
-
* Sets the default resources dictionary for the form
|
|
421
|
-
*/
|
|
422
|
-
set defaultResources(resources: PdfDefaultResourcesDictionary | null);
|
|
423
|
-
/**
|
|
424
|
-
* Sets multiple field values by field name.
|
|
425
|
-
* @param values Object with field names as keys and values to set
|
|
426
|
-
* */
|
|
427
|
-
setValues(values: Partial<T>): void;
|
|
428
|
-
importData(fields: T): void;
|
|
429
|
-
exportData(): Partial<T>;
|
|
430
|
-
/**
|
|
431
|
-
* Gets the encoding map for a specific font in the form's resources.
|
|
432
|
-
* Returns null if no custom encoding is found.
|
|
433
|
-
* Results are cached for performance.
|
|
434
|
-
*/
|
|
435
|
-
getFontEncodingMap(fontName: string): Promise<Map<number, string> | null>;
|
|
436
|
-
static fromDocument(document: PdfDocument): Promise<PdfAcroForm | null>;
|
|
437
|
-
/**
|
|
438
|
-
* Pre-caches encoding maps for all fonts used in the form fields.
|
|
439
|
-
* This makes subsequent field value access faster and synchronous.
|
|
440
|
-
*/
|
|
441
|
-
private cacheAllFontEncodings;
|
|
442
|
-
/**
|
|
443
|
-
* Gets or creates the Annots array for a page.
|
|
444
|
-
* Returns the array and metadata about whether it's an indirect object.
|
|
445
|
-
*/
|
|
446
|
-
private getPageAnnotsArray;
|
|
447
|
-
/**
|
|
448
|
-
* Adds field references to a page's Annots array, avoiding duplicates.
|
|
449
|
-
*/
|
|
450
|
-
private addFieldsToAnnots;
|
|
451
|
-
/**
|
|
452
|
-
* Updates page annotations to include new form field references.
|
|
453
|
-
*/
|
|
454
|
-
private updatePageAnnotations;
|
|
455
|
-
write(document: PdfDocument): Promise<void>;
|
|
456
|
-
}
|
|
5
|
+
export { PdfFormField as PdfAcroFormField } from './fields/pdf-form-field.js';
|
|
6
|
+
export { PdfAcroForm } from './pdf-acro-form.js';
|
|
7
|
+
export type { PdfDefaultResourcesDictionary } from './pdf-acro-form.js';
|
|
8
|
+
export { PdfFieldType } from './fields/types.js';
|
|
9
|
+
export type { PdfAppearanceStreamDictionary } from '../annotations/index.js';
|