@libpdf/core 0.0.1-beta.6 → 0.0.1-beta.8

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/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- import { z } from "zod";
2
1
  import * as _google_cloud_kms0 from "@google-cloud/kms";
3
2
  import * as _google_cloud_secret_manager0 from "@google-cloud/secret-manager";
4
3
 
@@ -1212,7 +1211,7 @@ declare class PdfStream extends PdfDict {
1212
1211
  * @returns Decoded data
1213
1212
  * @throws {Error} if a filter fails or is unknown
1214
1213
  */
1215
- getDecodedData(): Promise<Uint8Array>;
1214
+ getDecodedData(): Uint8Array;
1216
1215
  /**
1217
1216
  * Get the encoded (compressed) stream data.
1218
1217
  *
@@ -1228,7 +1227,7 @@ declare class PdfStream extends PdfDict {
1228
1227
  *
1229
1228
  * @returns Encoded data (compressed if filters are specified)
1230
1229
  */
1231
- getEncodedData(): Promise<Uint8Array>;
1230
+ getEncodedData(): Uint8Array;
1232
1231
  /**
1233
1232
  * Build filter specs from /Filter and /DecodeParms entries.
1234
1233
  */
@@ -1931,6 +1930,12 @@ interface Permissions {
1931
1930
  }
1932
1931
  //#endregion
1933
1932
  //#region src/security/schemas.d.ts
1933
+ /**
1934
+ * Zod schemas for PDF encryption dictionary validation.
1935
+ *
1936
+ * These schemas provide type-safe parsing of encryption parameters
1937
+ * with proper validation and TypeScript type inference.
1938
+ */
1934
1939
  /**
1935
1940
  * Valid encryption versions (V entry).
1936
1941
  *
@@ -1940,8 +1945,7 @@ interface Permissions {
1940
1945
  * - 4: AES-128 or RC4 with crypt filters (PDF 1.5)
1941
1946
  * - 5: AES-256 (PDF 2.0)
1942
1947
  */
1943
- declare const VersionSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
1944
- type Version = z.infer<typeof VersionSchema>;
1948
+ type EncryptionVersion = 1 | 2 | 3 | 4 | 5;
1945
1949
  /**
1946
1950
  * Valid encryption revisions (R entry).
1947
1951
  *
@@ -1951,25 +1955,31 @@ type Version = z.infer<typeof VersionSchema>;
1951
1955
  * - 5: V=5, AES-256 (draft, Adobe Extension Level 3)
1952
1956
  * - 6: V=5, AES-256 (final, ISO 32000-2)
1953
1957
  */
1954
- declare const RevisionSchema: z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>]>;
1955
- type Revision = z.infer<typeof RevisionSchema>;
1958
+ type EncryptionRevision = 2 | 3 | 4 | 5 | 6;
1959
+ /**
1960
+ * Crypt filter methods (CFM entry).
1961
+ *
1962
+ * - None: Identity (no encryption)
1963
+ * - V2: RC4
1964
+ * - AESV2: AES-128
1965
+ * - AESV3: AES-256
1966
+ */
1967
+ type CryptFilterMethod = "None" | "V2" | "AESV2" | "AESV3";
1968
+ /**
1969
+ * Authentication events (AuthEvent entry).
1970
+ *
1971
+ * - DocOpen: Authentication when document is opened
1972
+ * - EFOpen: Authentication when embedded file is accessed
1973
+ */
1974
+ type AuthEvent = "DocOpen" | "EFOpen";
1956
1975
  /**
1957
1976
  * Complete crypt filter configuration.
1958
1977
  */
1959
- declare const CryptFilterSchema: z.ZodObject<{
1960
- cfm: z.ZodEnum<{
1961
- None: "None";
1962
- V2: "V2";
1963
- AESV2: "AESV2";
1964
- AESV3: "AESV3";
1965
- }>;
1966
- authEvent: z.ZodOptional<z.ZodEnum<{
1967
- DocOpen: "DocOpen";
1968
- EFOpen: "EFOpen";
1969
- }>>;
1970
- length: z.ZodOptional<z.ZodNumber>;
1971
- }, z.core.$strip>;
1972
- type CryptFilter = z.infer<typeof CryptFilterSchema>;
1978
+ interface CryptFilter {
1979
+ cfm: CryptFilterMethod;
1980
+ authEvent?: AuthEvent;
1981
+ length?: number;
1982
+ }
1973
1983
  /**
1974
1984
  * Supported encryption algorithms.
1975
1985
  *
@@ -1977,12 +1987,7 @@ type CryptFilter = z.infer<typeof CryptFilterSchema>;
1977
1987
  * - AES-128: AES with 128-bit key (R4)
1978
1988
  * - AES-256: AES with 256-bit key (R5-R6)
1979
1989
  */
1980
- declare const EncryptionAlgorithmSchema: z.ZodEnum<{
1981
- RC4: "RC4";
1982
- "AES-128": "AES-128";
1983
- "AES-256": "AES-256";
1984
- }>;
1985
- type EncryptionAlgorithm = z.infer<typeof EncryptionAlgorithmSchema>;
1990
+ type EncryptionAlgorithm = "RC4" | "AES-128" | "AES-256";
1986
1991
  //#endregion
1987
1992
  //#region src/security/errors.d.ts
1988
1993
  /**
@@ -2021,9 +2026,9 @@ interface EncryptionDict {
2021
2026
  /** Security handler filter (always "Standard" for this implementation) */
2022
2027
  filter: "Standard";
2023
2028
  /** Algorithm version: 1, 2, 3, 4, or 5 */
2024
- version: Version;
2029
+ version: EncryptionVersion;
2025
2030
  /** Standard security handler revision: 2, 3, 4, 5, or 6 */
2026
- revision: Revision;
2031
+ revision: EncryptionRevision;
2027
2032
  /** Key length in bits (40-256) */
2028
2033
  keyLengthBits: number;
2029
2034
  /** Owner password verification value (32 bytes for R2-R4, 48 bytes for R5-R6) */
@@ -2120,11 +2125,11 @@ declare class StandardSecurityHandler {
2120
2125
  /**
2121
2126
  * Get the encryption version.
2122
2127
  */
2123
- get version(): Version;
2128
+ get version(): EncryptionVersion;
2124
2129
  /**
2125
2130
  * Get the encryption revision.
2126
2131
  */
2127
- get revision(): Revision;
2132
+ get revision(): EncryptionRevision;
2128
2133
  /**
2129
2134
  * Get document permissions.
2130
2135
  */
@@ -2478,8 +2483,8 @@ interface SignOptions {
2478
2483
  * Warning emitted during signing.
2479
2484
  */
2480
2485
  interface SignWarning {
2481
- /** Warning code */
2482
- code: "MDP_VIOLATION" | "CHAIN_INCOMPLETE" | string;
2486
+ /** Warning code (e.g., "MDP_VIOLATION", "CHAIN_INCOMPLETE") */
2487
+ code: "MDP_VIOLATION" | "CHAIN_INCOMPLETE" | (string & {});
2483
2488
  /** Human-readable message */
2484
2489
  message: string;
2485
2490
  }
@@ -2699,8 +2704,12 @@ interface FindTextOptions {
2699
2704
  /**
2700
2705
  * Function to resolve objects not yet in the registry.
2701
2706
  * Called when resolve() encounters an unknown reference.
2707
+ *
2708
+ * This is synchronous because all PDF data is loaded into memory
2709
+ * at parse time. The resolver simply parses objects on demand from
2710
+ * the in-memory buffer.
2702
2711
  */
2703
- type ObjectResolver = (ref: PdfRef) => Promise<PdfObject | null>;
2712
+ type ObjectResolver = (ref: PdfRef) => PdfObject | null;
2704
2713
  /**
2705
2714
  * Registry for managing PDF objects and their references.
2706
2715
  *
@@ -2795,7 +2804,7 @@ declare class ObjectRegistry {
2795
2804
  * @param ref - The reference to resolve
2796
2805
  * @returns The object, or null if not found
2797
2806
  */
2798
- resolve(ref: PdfRef): Promise<PdfObject | null>;
2807
+ resolve(ref: PdfRef): PdfObject | null;
2799
2808
  /**
2800
2809
  * Add a warning message.
2801
2810
  */
@@ -2836,8 +2845,10 @@ declare class ObjectRegistry {
2836
2845
  //#region src/document/name-tree.d.ts
2837
2846
  /**
2838
2847
  * Function to resolve a reference to its object.
2848
+ *
2849
+ * Synchronous because all PDF data is loaded into memory at parse time.
2839
2850
  */
2840
- type Resolver = (ref: PdfRef) => Promise<PdfObject | null>;
2851
+ type Resolver = (ref: PdfRef) => PdfObject | null;
2841
2852
  /**
2842
2853
  * PDF Name Tree reader.
2843
2854
  *
@@ -2855,20 +2866,20 @@ declare class NameTree {
2855
2866
  *
2856
2867
  * @returns The value if found, null otherwise
2857
2868
  */
2858
- get(key: string): Promise<PdfObject | null>;
2869
+ get(key: string): PdfObject | null;
2859
2870
  /**
2860
2871
  * Check if a key exists in the tree.
2861
2872
  */
2862
- has(key: string): Promise<boolean>;
2873
+ has(key: string): boolean;
2863
2874
  /**
2864
2875
  * Iterate all entries (lazy, yields [key, value] pairs).
2865
2876
  * Uses BFS traversal with cycle detection.
2866
2877
  */
2867
- entries(): AsyncGenerator<[string, PdfObject]>;
2878
+ entries(): Generator<[string, PdfObject]>;
2868
2879
  /**
2869
2880
  * Load all entries into a Map (cached after first call).
2870
2881
  */
2871
- getAll(): Promise<ReadonlyMap<string, PdfObject>>;
2882
+ getAll(): ReadonlyMap<string, PdfObject>;
2872
2883
  /**
2873
2884
  * Check if all entries have been loaded into cache.
2874
2885
  */
@@ -2903,24 +2914,24 @@ declare class PDFCatalog {
2903
2914
  /**
2904
2915
  * Get the /Names dictionary.
2905
2916
  */
2906
- getNames(): Promise<PdfDict | null>;
2917
+ getNames(): PdfDict | null;
2907
2918
  /**
2908
2919
  * Get or create the /Names dictionary.
2909
2920
  */
2910
- getOrCreateNames(): Promise<PdfDict>;
2921
+ getOrCreateNames(): PdfDict;
2911
2922
  /**
2912
2923
  * Get the EmbeddedFiles name tree.
2913
2924
  * Caches the result for repeated access.
2914
2925
  */
2915
- getEmbeddedFilesTree(): Promise<NameTree | null>;
2926
+ getEmbeddedFilesTree(): NameTree | null;
2916
2927
  /**
2917
2928
  * Set the EmbeddedFiles name tree.
2918
2929
  */
2919
- setEmbeddedFilesTree(treeDict: PdfDict): Promise<void>;
2930
+ setEmbeddedFilesTree(treeDict: PdfDict): void;
2920
2931
  /**
2921
2932
  * Remove the EmbeddedFiles entry from /Names.
2922
2933
  */
2923
- removeEmbeddedFilesTree(): Promise<void>;
2934
+ removeEmbeddedFilesTree(): void;
2924
2935
  /**
2925
2936
  * Clear all cached name trees.
2926
2937
  * Call this after modifying the catalog structure.
@@ -2954,9 +2965,8 @@ declare class PDFPageTree {
2954
2965
  private constructor();
2955
2966
  /**
2956
2967
  * Load and build the page tree by walking from the root.
2957
- * This is the only async operation.
2958
2968
  */
2959
- static load(pagesRef: PdfRef, getObject: (ref: PdfRef) => Promise<PdfObject | null>): Promise<PDFPageTree>;
2969
+ static load(pagesRef: PdfRef, getObject: (ref: PdfRef) => PdfObject | null): PDFPageTree;
2960
2970
  /**
2961
2971
  * Create an empty page tree.
2962
2972
  * Note: This creates a minimal tree without a backing PDF structure.
@@ -3080,9 +3090,13 @@ declare class PDFContext {
3080
3090
  */
3081
3091
  register(obj: PdfObject): PdfRef;
3082
3092
  /**
3083
- * Resolve an object by reference (async, fetches if needed).
3093
+ * Resolve an object by reference.
3094
+ *
3095
+ * Synchronously resolves the reference, parsing from the in-memory
3096
+ * buffer if not already cached. All PDF data is loaded at parse time,
3097
+ * so this operation never requires I/O.
3084
3098
  */
3085
- resolve(ref: PdfRef): Promise<PdfObject | null>;
3099
+ resolve(ref: PdfRef): PdfObject | null;
3086
3100
  /**
3087
3101
  * Get an object by reference (sync, only if already loaded).
3088
3102
  */
@@ -3122,7 +3136,7 @@ declare class PDFAttachments {
3122
3136
  * }
3123
3137
  * ```
3124
3138
  */
3125
- list(): Promise<Map<string, AttachmentInfo>>;
3139
+ list(): Map<string, AttachmentInfo>;
3126
3140
  /**
3127
3141
  * Get the raw bytes of an attachment.
3128
3142
  *
@@ -3138,7 +3152,7 @@ declare class PDFAttachments {
3138
3152
  * }
3139
3153
  * ```
3140
3154
  */
3141
- get(name: string): Promise<Uint8Array | null>;
3155
+ get(name: string): Uint8Array | null;
3142
3156
  /**
3143
3157
  * Check if an attachment exists.
3144
3158
  *
@@ -3152,7 +3166,7 @@ declare class PDFAttachments {
3152
3166
  * }
3153
3167
  * ```
3154
3168
  */
3155
- has(name: string): Promise<boolean>;
3169
+ has(name: string): boolean;
3156
3170
  /**
3157
3171
  * Add a file attachment to the document.
3158
3172
  *
@@ -3176,7 +3190,7 @@ declare class PDFAttachments {
3176
3190
  * await pdf.attachments.add("report.pdf", newBytes, { overwrite: true });
3177
3191
  * ```
3178
3192
  */
3179
- add(name: string, data: Uint8Array, options?: AddAttachmentOptions): Promise<void>;
3193
+ add(name: string, data: Uint8Array, options?: AddAttachmentOptions): void;
3180
3194
  /**
3181
3195
  * Remove an attachment from the document.
3182
3196
  *
@@ -3191,7 +3205,7 @@ declare class PDFAttachments {
3191
3205
  * }
3192
3206
  * ```
3193
3207
  */
3194
- remove(name: string): Promise<boolean>;
3208
+ remove(name: string): boolean;
3195
3209
  }
3196
3210
  //#endregion
3197
3211
  //#region src/helpers/colors.d.ts
@@ -3566,8 +3580,8 @@ interface PolylineAnnotationOptions {
3566
3580
  interface StampAnnotationOptions {
3567
3581
  /** Annotation rectangle */
3568
3582
  rect: Rect;
3569
- /** Standard stamp name */
3570
- name?: StampName | string;
3583
+ /** Stamp name (use StampName constants for standard stamps, or any string for custom) */
3584
+ name?: StampName | (string & {});
3571
3585
  /** Text content/comment */
3572
3586
  contents?: string;
3573
3587
  }
@@ -3722,15 +3736,15 @@ declare class PDFAnnotation {
3722
3736
  /**
3723
3737
  * Get the normal appearance stream.
3724
3738
  */
3725
- getNormalAppearance(): Promise<PdfStream | null>;
3739
+ getNormalAppearance(): PdfStream | null;
3726
3740
  /**
3727
3741
  * Get the rollover appearance stream.
3728
3742
  */
3729
- getRolloverAppearance(): Promise<PdfStream | null>;
3743
+ getRolloverAppearance(): PdfStream | null;
3730
3744
  /**
3731
3745
  * Get the down appearance stream.
3732
3746
  */
3733
- getDownAppearance(): Promise<PdfStream | null>;
3747
+ getDownAppearance(): PdfStream | null;
3734
3748
  /**
3735
3749
  * Set the normal appearance stream.
3736
3750
  */
@@ -3829,7 +3843,7 @@ declare class PDFMarkupAnnotation extends PDFAnnotation {
3829
3843
  /**
3830
3844
  * Get the associated popup annotation, if any.
3831
3845
  */
3832
- getPopup(): Promise<PDFPopupAnnotation | null>;
3846
+ getPopup(): PDFPopupAnnotation | null;
3833
3847
  /**
3834
3848
  * Create a popup annotation associated with this annotation.
3835
3849
  * The popup is added to the parent annotation and registered.
@@ -3885,11 +3899,11 @@ declare class PDFFileAttachmentAnnotation extends PDFMarkupAnnotation {
3885
3899
  /**
3886
3900
  * Get the file specification dictionary.
3887
3901
  */
3888
- getFileSpec(): Promise<PdfDict | null>;
3902
+ getFileSpec(): PdfDict | null;
3889
3903
  /**
3890
3904
  * Get the file name from the file specification.
3891
3905
  */
3892
- getFileName(): Promise<string | null>;
3906
+ getFileName(): string | null;
3893
3907
  }
3894
3908
  //#endregion
3895
3909
  //#region src/annotations/free-text.d.ts
@@ -4062,7 +4076,7 @@ declare class PDFLinkAnnotation extends PDFAnnotation {
4062
4076
  /**
4063
4077
  * Get the parsed link action.
4064
4078
  */
4065
- getAction(): Promise<LinkAction>;
4079
+ getAction(): LinkAction;
4066
4080
  /**
4067
4081
  * Highlight mode when the link is clicked.
4068
4082
  */
@@ -4194,7 +4208,7 @@ declare class PDFStampAnnotation extends PDFMarkupAnnotation {
4194
4208
  /**
4195
4209
  * Set the stamp name.
4196
4210
  */
4197
- setStampName(name: StampName | string): void;
4211
+ setStampName(name: StampName | (string & {})): void;
4198
4212
  /**
4199
4213
  * Check if this is a standard stamp.
4200
4214
  */
@@ -4646,15 +4660,15 @@ declare class WidgetAnnotation {
4646
4660
  * Get normal appearance stream.
4647
4661
  * For stateful widgets (checkbox/radio), pass the state name.
4648
4662
  */
4649
- getNormalAppearance(state?: string): Promise<PdfStream | null>;
4663
+ getNormalAppearance(state?: string): PdfStream | null;
4650
4664
  /**
4651
4665
  * Get rollover appearance stream (shown on mouse hover).
4652
4666
  */
4653
- getRolloverAppearance(state?: string): Promise<PdfStream | null>;
4667
+ getRolloverAppearance(state?: string): PdfStream | null;
4654
4668
  /**
4655
4669
  * Get down appearance stream (shown when clicked).
4656
4670
  */
4657
- getDownAppearance(state?: string): Promise<PdfStream | null>;
4671
+ getDownAppearance(state?: string): PdfStream | null;
4658
4672
  /**
4659
4673
  * Get border style.
4660
4674
  */
@@ -4676,7 +4690,7 @@ declare class WidgetAnnotation {
4676
4690
  */
4677
4691
  interface AcroFormLike {
4678
4692
  defaultQuadding: number;
4679
- updateFieldAppearance?(field: TerminalField): Promise<void>;
4693
+ updateFieldAppearance?(field: TerminalField): void;
4680
4694
  }
4681
4695
  /**
4682
4696
  * Field type identifiers.
@@ -4865,7 +4879,7 @@ declare abstract class TerminalField extends FormField {
4865
4879
  *
4866
4880
  * @internal
4867
4881
  */
4868
- resolveWidgets(): Promise<void>;
4882
+ resolveWidgets(): void;
4869
4883
  /**
4870
4884
  * Resolve MK dictionary if it's a reference.
4871
4885
  * This ensures getAppearanceCharacteristics() can work synchronously.
@@ -4887,7 +4901,7 @@ declare abstract class TerminalField extends FormField {
4887
4901
  * This method is async because it regenerates the field's appearance
4888
4902
  * stream after resetting the value.
4889
4903
  */
4890
- resetValue(): Promise<void>;
4904
+ resetValue(): void;
4891
4905
  /**
4892
4906
  * Check read-only and throw if set.
4893
4907
  */
@@ -4900,7 +4914,7 @@ declare abstract class TerminalField extends FormField {
4900
4914
  *
4901
4915
  * @internal
4902
4916
  */
4903
- protected applyChange(): Promise<void>;
4917
+ protected applyChange(): void;
4904
4918
  }
4905
4919
  //#endregion
4906
4920
  //#region src/document/forms/fields/checkbox-field.d.ts
@@ -4936,11 +4950,11 @@ declare class CheckboxField extends TerminalField {
4936
4950
  /**
4937
4951
  * Check the checkbox (sets to the on-value).
4938
4952
  */
4939
- check(): Promise<void>;
4953
+ check(): void;
4940
4954
  /**
4941
4955
  * Uncheck the checkbox (sets to "Off").
4942
4956
  */
4943
- uncheck(): Promise<void>;
4957
+ uncheck(): void;
4944
4958
  /**
4945
4959
  * Set the checkbox value.
4946
4960
  *
@@ -4950,7 +4964,7 @@ declare class CheckboxField extends TerminalField {
4950
4964
  * @param value "Off" or one of the on-values
4951
4965
  * @throws {Error} if field is read-only or value is invalid
4952
4966
  */
4953
- setValue(value: string): Promise<void>;
4967
+ setValue(value: string): void;
4954
4968
  }
4955
4969
  //#endregion
4956
4970
  //#region src/document/forms/fields/choice-fields.d.ts
@@ -4992,7 +5006,7 @@ declare class DropdownField extends TerminalField {
4992
5006
  * @param value The value to select
4993
5007
  * @throws {Error} if field is read-only or value is invalid (for non-editable dropdowns)
4994
5008
  */
4995
- setValue(value: string): Promise<void>;
5009
+ setValue(value: string): void;
4996
5010
  }
4997
5011
  /**
4998
5012
  * List box field.
@@ -5035,7 +5049,7 @@ declare class ListBoxField extends TerminalField {
5035
5049
  * @param values Array of values to select
5036
5050
  * @throws {Error} if field is read-only, multiple selection not allowed, or values are invalid
5037
5051
  */
5038
- setValue(values: string[]): Promise<void>;
5052
+ setValue(values: string[]): void;
5039
5053
  }
5040
5054
  //#endregion
5041
5055
  //#region src/document/forms/fields/other-fields.d.ts
@@ -5108,7 +5122,7 @@ declare class RadioField extends TerminalField {
5108
5122
  * @param option One of getOptions() or null to deselect
5109
5123
  * @throws {Error} if field is read-only, option is invalid, or deselection not allowed
5110
5124
  */
5111
- setValue(option: string | null): Promise<void>;
5125
+ setValue(option: string | null): void;
5112
5126
  }
5113
5127
  //#endregion
5114
5128
  //#region src/document/forms/fields/text-field.d.ts
@@ -5148,7 +5162,7 @@ declare class TextField extends TerminalField {
5148
5162
  * @param value The new text value
5149
5163
  * @throws {Error} if field is read-only
5150
5164
  */
5151
- setValue(value: string): Promise<void>;
5165
+ setValue(value: string): void;
5152
5166
  }
5153
5167
  //#endregion
5154
5168
  //#region src/fonts/standard-14.d.ts
@@ -5743,7 +5757,7 @@ declare class PDFPage {
5743
5757
  * await page.drawField(paymentRadio, { x: 100, y: 520, width: 16, height: 16, option: "PayPal" });
5744
5758
  * ```
5745
5759
  */
5746
- drawField(field: FormField, options: DrawFieldOptions): Promise<void>;
5760
+ drawField(field: FormField, options: DrawFieldOptions): void;
5747
5761
  /**
5748
5762
  * Build a widget annotation dictionary for a field.
5749
5763
  */
@@ -5928,84 +5942,84 @@ declare class PDFPage {
5928
5942
  *
5929
5943
  * @example
5930
5944
  * ```typescript
5931
- * const annotations = await page.getAnnotations();
5945
+ * const annotations = page.getAnnotations();
5932
5946
  * for (const annot of annotations) {
5933
5947
  * console.log(annot.type, annot.contents);
5934
5948
  * }
5935
5949
  * ```
5936
5950
  */
5937
- getAnnotations(): Promise<PDFAnnotation[]>;
5951
+ getAnnotations(): PDFAnnotation[];
5938
5952
  /**
5939
5953
  * Get all popup annotations on this page.
5940
5954
  *
5941
5955
  * Popups are typically accessed via their parent markup annotation
5942
5956
  * using `annotation.getPopup()`, but this method allows direct access.
5943
5957
  */
5944
- getPopupAnnotations(): Promise<PDFPopupAnnotation[]>;
5958
+ getPopupAnnotations(): PDFPopupAnnotation[];
5945
5959
  /**
5946
5960
  * Get all highlight annotations on this page.
5947
5961
  */
5948
- getHighlightAnnotations(): Promise<PDFHighlightAnnotation[]>;
5962
+ getHighlightAnnotations(): PDFHighlightAnnotation[];
5949
5963
  /**
5950
5964
  * Get all underline annotations on this page.
5951
5965
  */
5952
- getUnderlineAnnotations(): Promise<PDFUnderlineAnnotation[]>;
5966
+ getUnderlineAnnotations(): PDFUnderlineAnnotation[];
5953
5967
  /**
5954
5968
  * Get all strikeout annotations on this page.
5955
5969
  */
5956
- getStrikeOutAnnotations(): Promise<PDFStrikeOutAnnotation[]>;
5970
+ getStrikeOutAnnotations(): PDFStrikeOutAnnotation[];
5957
5971
  /**
5958
5972
  * Get all squiggly annotations on this page.
5959
5973
  */
5960
- getSquigglyAnnotations(): Promise<PDFSquigglyAnnotation[]>;
5974
+ getSquigglyAnnotations(): PDFSquigglyAnnotation[];
5961
5975
  /**
5962
5976
  * Get all link annotations on this page.
5963
5977
  */
5964
- getLinkAnnotations(): Promise<PDFLinkAnnotation[]>;
5978
+ getLinkAnnotations(): PDFLinkAnnotation[];
5965
5979
  /**
5966
5980
  * Get all text annotations (sticky notes) on this page.
5967
5981
  */
5968
- getTextAnnotations(): Promise<PDFTextAnnotation[]>;
5982
+ getTextAnnotations(): PDFTextAnnotation[];
5969
5983
  /**
5970
5984
  * Get all free text annotations on this page.
5971
5985
  */
5972
- getFreeTextAnnotations(): Promise<PDFFreeTextAnnotation[]>;
5986
+ getFreeTextAnnotations(): PDFFreeTextAnnotation[];
5973
5987
  /**
5974
5988
  * Get all line annotations on this page.
5975
5989
  */
5976
- getLineAnnotations(): Promise<PDFLineAnnotation[]>;
5990
+ getLineAnnotations(): PDFLineAnnotation[];
5977
5991
  /**
5978
5992
  * Get all square annotations on this page.
5979
5993
  */
5980
- getSquareAnnotations(): Promise<PDFSquareAnnotation[]>;
5994
+ getSquareAnnotations(): PDFSquareAnnotation[];
5981
5995
  /**
5982
5996
  * Get all circle annotations on this page.
5983
5997
  */
5984
- getCircleAnnotations(): Promise<PDFCircleAnnotation[]>;
5998
+ getCircleAnnotations(): PDFCircleAnnotation[];
5985
5999
  /**
5986
6000
  * Get all stamp annotations on this page.
5987
6001
  */
5988
- getStampAnnotations(): Promise<PDFStampAnnotation[]>;
6002
+ getStampAnnotations(): PDFStampAnnotation[];
5989
6003
  /**
5990
6004
  * Get all ink annotations on this page.
5991
6005
  */
5992
- getInkAnnotations(): Promise<PDFInkAnnotation[]>;
6006
+ getInkAnnotations(): PDFInkAnnotation[];
5993
6007
  /**
5994
6008
  * Get all polygon annotations on this page.
5995
6009
  */
5996
- getPolygonAnnotations(): Promise<PDFPolygonAnnotation[]>;
6010
+ getPolygonAnnotations(): PDFPolygonAnnotation[];
5997
6011
  /**
5998
6012
  * Get all polyline annotations on this page.
5999
6013
  */
6000
- getPolylineAnnotations(): Promise<PDFPolylineAnnotation[]>;
6014
+ getPolylineAnnotations(): PDFPolylineAnnotation[];
6001
6015
  /**
6002
6016
  * Get all caret annotations on this page.
6003
6017
  */
6004
- getCaretAnnotations(): Promise<PDFCaretAnnotation[]>;
6018
+ getCaretAnnotations(): PDFCaretAnnotation[];
6005
6019
  /**
6006
6020
  * Get all file attachment annotations on this page.
6007
6021
  */
6008
- getFileAttachmentAnnotations(): Promise<PDFFileAttachmentAnnotation[]>;
6022
+ getFileAttachmentAnnotations(): PDFFileAttachmentAnnotation[];
6009
6023
  /**
6010
6024
  * Add a highlight annotation.
6011
6025
  *
@@ -6126,11 +6140,11 @@ declare class PDFPage {
6126
6140
  *
6127
6141
  * @example
6128
6142
  * ```typescript
6129
- * const highlights = await page.getHighlightAnnotations();
6130
- * await page.removeAnnotation(highlights[0]);
6143
+ * const highlights = page.getHighlightAnnotations();
6144
+ * page.removeAnnotation(highlights[0]);
6131
6145
  * ```
6132
6146
  */
6133
- removeAnnotation(annotation: PDFAnnotation): Promise<void>;
6147
+ removeAnnotation(annotation: PDFAnnotation): void;
6134
6148
  /**
6135
6149
  * Remove annotations from the page.
6136
6150
  *
@@ -6142,13 +6156,13 @@ declare class PDFPage {
6142
6156
  * @example
6143
6157
  * ```typescript
6144
6158
  * // Remove all highlights
6145
- * await page.removeAnnotations({ type: "Highlight" });
6159
+ * page.removeAnnotations({ type: "Highlight" });
6146
6160
  *
6147
6161
  * // Remove all annotations
6148
- * await page.removeAnnotations();
6162
+ * page.removeAnnotations();
6149
6163
  * ```
6150
6164
  */
6151
- removeAnnotations(options?: RemoveAnnotationsOptions): Promise<void>;
6165
+ removeAnnotations(options?: RemoveAnnotationsOptions): void;
6152
6166
  /**
6153
6167
  * Add an annotation reference to the page's /Annots array.
6154
6168
  * Internal method - also invalidates the annotation cache.
@@ -6227,7 +6241,7 @@ declare class PDFPage {
6227
6241
  *
6228
6242
  * @example
6229
6243
  * ```typescript
6230
- * const pageText = await page.extractText();
6244
+ * const pageText = page.extractText();
6231
6245
  * console.log(pageText.text); // Plain text
6232
6246
  *
6233
6247
  * // Access structured content
@@ -6236,7 +6250,7 @@ declare class PDFPage {
6236
6250
  * }
6237
6251
  * ```
6238
6252
  */
6239
- extractText(_options?: ExtractTextOptions): Promise<PageText>;
6253
+ extractText(_options?: ExtractTextOptions): PageText;
6240
6254
  /**
6241
6255
  * Search for text on this page.
6242
6256
  *
@@ -6247,16 +6261,16 @@ declare class PDFPage {
6247
6261
  * @example
6248
6262
  * ```typescript
6249
6263
  * // String search
6250
- * const matches = await page.findText("{{ name }}");
6264
+ * const matches = page.findText("{{ name }}");
6251
6265
  * for (const match of matches) {
6252
6266
  * console.log(`Found at:`, match.bbox);
6253
6267
  * }
6254
6268
  *
6255
6269
  * // Regex search
6256
- * const placeholders = await page.findText(/\{\{\s*\w+\s*\}\}/g);
6270
+ * const placeholders = page.findText(/\{\{\s*\w+\s*\}\}/g);
6257
6271
  * ```
6258
6272
  */
6259
- findText(query: string | RegExp, options?: FindTextOptions): Promise<TextMatch[]>;
6273
+ findText(query: string | RegExp, options?: FindTextOptions): TextMatch[];
6260
6274
  /**
6261
6275
  * Get the concatenated content stream bytes.
6262
6276
  */
@@ -6373,11 +6387,11 @@ declare class PDFFonts {
6373
6387
  *
6374
6388
  * @param subsetFonts - Whether to subset fonts (only include used glyphs)
6375
6389
  */
6376
- finalize(subsetFonts: boolean): Promise<void>;
6390
+ finalize(subsetFonts: boolean): void;
6377
6391
  /**
6378
6392
  * @deprecated Use `finalize()` instead. This method exists for backwards compatibility.
6379
6393
  */
6380
- prepare(): Promise<void>;
6394
+ prepare(): void;
6381
6395
  }
6382
6396
  //#endregion
6383
6397
  //#region src/document/forms/field-tree.d.ts
@@ -6387,7 +6401,7 @@ declare class PDFFonts {
6387
6401
  interface FieldTreeSource {
6388
6402
  getDict(): PdfDict;
6389
6403
  defaultQuadding: number;
6390
- updateFieldAppearance?(field: TerminalField): Promise<void>;
6404
+ updateFieldAppearance?(field: TerminalField): void;
6391
6405
  }
6392
6406
  /**
6393
6407
  * FieldTree provides safe, synchronous iteration over the form field hierarchy.
@@ -6426,7 +6440,7 @@ declare class FieldTree implements Iterable<FormField> {
6426
6440
  * @param registry The object registry for resolving references
6427
6441
  * @returns A fully-loaded FieldTree
6428
6442
  */
6429
- static load(acroForm: FieldTreeSource, registry: ObjectRegistry): Promise<FieldTree>;
6443
+ static load(acroForm: FieldTreeSource, registry: ObjectRegistry): FieldTree;
6430
6444
  /**
6431
6445
  * Iterate over all fields (terminal and non-terminal).
6432
6446
  * Fields are yielded in breadth-first order.
@@ -6483,6 +6497,16 @@ interface FlattenOptions {
6483
6497
  font?: FormFont;
6484
6498
  /** Font size to use (0 = auto) */
6485
6499
  fontSize?: number;
6500
+ /**
6501
+ * Skip signature fields during flattening.
6502
+ *
6503
+ * When true, signature fields are preserved as interactive fields while
6504
+ * all other fields are flattened. This is useful when you want to flatten
6505
+ * filled form data but keep signature fields available for signing.
6506
+ *
6507
+ * @default false
6508
+ */
6509
+ skipSignatures?: boolean;
6486
6510
  }
6487
6511
  //#endregion
6488
6512
  //#region src/document/forms/acro-form.d.ts
@@ -6509,11 +6533,11 @@ declare class AcroForm implements AcroFormLike {
6509
6533
  * @param registry The object registry for resolving references
6510
6534
  * @param pageTree Optional page tree for efficient page lookups during flattening
6511
6535
  */
6512
- static load(catalog: PdfDict, registry: ObjectRegistry, pageTree?: PDFPageTree): Promise<AcroForm | null>;
6536
+ static load(catalog: PdfDict, registry: ObjectRegistry, pageTree?: PDFPageTree): AcroForm | null;
6513
6537
  /**
6514
6538
  * Default resources dictionary (fonts, etc.).
6515
6539
  */
6516
- getDefaultResources(): Promise<PdfDict | null>;
6540
+ getDefaultResources(): PdfDict | null;
6517
6541
  /**
6518
6542
  * Default appearance string.
6519
6543
  */
@@ -6546,16 +6570,16 @@ declare class AcroForm implements AcroFormLike {
6546
6570
  * Get all terminal fields (flattened).
6547
6571
  * Non-terminal fields (containers) are not included.
6548
6572
  */
6549
- getFields(): Promise<TerminalField[]>;
6573
+ getFields(): TerminalField[];
6550
6574
  /**
6551
6575
  * Get field by fully-qualified name.
6552
6576
  * Returns null if not found.
6553
6577
  */
6554
- getField(name: string): Promise<TerminalField | null>;
6578
+ getField(name: string): TerminalField | null;
6555
6579
  /**
6556
6580
  * Get all fields of a specific type.
6557
6581
  */
6558
- getFieldsOfType<T extends TerminalField>(type: T["type"]): Promise<T[]>;
6582
+ getFieldsOfType<T extends TerminalField>(type: T["type"]): T[];
6559
6583
  /**
6560
6584
  * Get the underlying dictionary.
6561
6585
  */
@@ -6584,7 +6608,7 @@ declare class AcroForm implements AcroFormLike {
6584
6608
  * }
6585
6609
  * ```
6586
6610
  */
6587
- getFieldTree(): Promise<FieldTree>;
6611
+ getFieldTree(): FieldTree;
6588
6612
  /**
6589
6613
  * Clear the fields cache.
6590
6614
  * Call this after modifying the form structure.
@@ -6635,7 +6659,7 @@ declare class AcroForm implements AcroFormLike {
6635
6659
  *
6636
6660
  * @internal
6637
6661
  */
6638
- updateFieldAppearance(field: TerminalField): Promise<void>;
6662
+ updateFieldAppearance(field: TerminalField): void;
6639
6663
  /**
6640
6664
  * Update appearances for all fields that need it.
6641
6665
  *
@@ -6646,11 +6670,11 @@ declare class AcroForm implements AcroFormLike {
6646
6670
  */
6647
6671
  updateAppearances(options?: {
6648
6672
  forceRegenerate?: boolean;
6649
- }): Promise<void>;
6673
+ }): void;
6650
6674
  /**
6651
6675
  * Mark all fields as needing appearance update.
6652
6676
  */
6653
- markAllNeedAppearanceUpdate(): Promise<void>;
6677
+ markAllNeedAppearanceUpdate(): void;
6654
6678
  /**
6655
6679
  * Collect all terminal fields from a /Kids or /Fields array.
6656
6680
  */
@@ -6684,6 +6708,16 @@ declare class AcroForm implements AcroFormLike {
6684
6708
  * @param fieldRef Reference to the field dictionary
6685
6709
  */
6686
6710
  addField(fieldRef: PdfRef): void;
6711
+ /**
6712
+ * Remove a field reference from the Fields array.
6713
+ *
6714
+ * This only removes the field from the AcroForm's /Fields array.
6715
+ * Widget removal from pages must be handled separately.
6716
+ *
6717
+ * @param fieldRef Reference to the field dictionary to remove
6718
+ * @returns true if the field was found and removed, false otherwise
6719
+ */
6720
+ removeField(fieldRef: PdfRef): boolean;
6687
6721
  /**
6688
6722
  * Flatten all form fields into static page content.
6689
6723
  *
@@ -6699,7 +6733,7 @@ declare class AcroForm implements AcroFormLike {
6699
6733
  *
6700
6734
  * @param options Flattening options
6701
6735
  */
6702
- flatten(options?: FlattenOptions): Promise<void>;
6736
+ flatten(options?: FlattenOptions): void;
6703
6737
  }
6704
6738
  //#endregion
6705
6739
  //#region src/helpers/rotations.d.ts
@@ -6881,7 +6915,7 @@ declare class PDFForm {
6881
6915
  * @param ctx The PDF context
6882
6916
  * @returns PDFForm instance, or null if no form exists
6883
6917
  */
6884
- static load(ctx: PDFContext): Promise<PDFForm | null>;
6918
+ static load(ctx: PDFContext): PDFForm | null;
6885
6919
  /**
6886
6920
  * Get all form fields.
6887
6921
  */
@@ -7101,6 +7135,30 @@ declare class PDFForm {
7101
7135
  * ```
7102
7136
  */
7103
7137
  createListbox(name: string, options: ListboxOptions): ListBoxField;
7138
+ /**
7139
+ * Remove a form field from the document.
7140
+ *
7141
+ * This removes the field from the AcroForm and all its widget annotations
7142
+ * from their respective pages.
7143
+ *
7144
+ * @param fieldOrName - The field instance or field name to remove
7145
+ * @returns true if the field was found and removed, false otherwise
7146
+ *
7147
+ * @example
7148
+ * ```typescript
7149
+ * // Remove by field instance
7150
+ * const nameField = form.getTextField("name");
7151
+ * form.removeField(nameField);
7152
+ *
7153
+ * // Remove by name
7154
+ * form.removeField("email");
7155
+ * ```
7156
+ */
7157
+ removeField(fieldOrName: FormField | string): boolean;
7158
+ /**
7159
+ * Remove all widgets of a field from their respective pages.
7160
+ */
7161
+ private removeWidgetsFromPages;
7104
7162
  /**
7105
7163
  * Validate that a field name is unique.
7106
7164
  */
@@ -7139,14 +7197,14 @@ declare class PDFForm {
7139
7197
  * // result.skipped: ["nonexistent"]
7140
7198
  * ```
7141
7199
  */
7142
- fill(values: Record<string, FieldValue>): Promise<{
7200
+ fill(values: Record<string, FieldValue>): {
7143
7201
  filled: string[];
7144
7202
  skipped: string[];
7145
- }>;
7203
+ };
7146
7204
  /**
7147
7205
  * Reset all fields to their default values.
7148
7206
  */
7149
- resetAll(): Promise<void>;
7207
+ resetAll(): void;
7150
7208
  /**
7151
7209
  * Get form-level properties.
7152
7210
  */
@@ -7176,14 +7234,14 @@ declare class PDFForm {
7176
7234
  * Call this if the form structure has been modified externally
7177
7235
  * (e.g., fields added or removed via low-level API).
7178
7236
  */
7179
- reloadFields(): Promise<void>;
7237
+ reloadFields(): void;
7180
7238
  /**
7181
7239
  * Update appearance streams for all modified fields.
7182
7240
  *
7183
7241
  * This regenerates the visual appearance of fields whose values have changed.
7184
7242
  * Called automatically during `flatten()`.
7185
7243
  */
7186
- updateAppearances(): Promise<void>;
7244
+ updateAppearances(): void;
7187
7245
  /**
7188
7246
  * Flatten all form fields into static page content.
7189
7247
  *
@@ -7202,8 +7260,15 @@ declare class PDFForm {
7202
7260
  * await pdf.form.flatten();
7203
7261
  * const bytes = await pdf.save();
7204
7262
  * ```
7263
+ *
7264
+ * @example Flatten while preserving signature fields
7265
+ * ```typescript
7266
+ * await pdf.form.fill({ name: "John Doe" });
7267
+ * await pdf.form.flatten({ skipSignatures: true });
7268
+ * // Signature fields remain interactive for signing
7269
+ * ```
7205
7270
  */
7206
- flatten(options?: FlattenOptions): Promise<void>;
7271
+ flatten(options?: FlattenOptions): void;
7207
7272
  /**
7208
7273
  * Get the underlying AcroForm for low-level operations.
7209
7274
  *
@@ -7862,18 +7927,18 @@ declare class PDF {
7862
7927
  *
7863
7928
  * Objects are cached and tracked for modifications.
7864
7929
  */
7865
- getObject(ref: PdfRef): Promise<PdfObject | null>;
7930
+ getObject(ref: PdfRef): PdfObject | null;
7866
7931
  /**
7867
7932
  * Get the document catalog dictionary.
7868
7933
  *
7869
7934
  * Note: For internal use, prefer accessing the catalog via context which
7870
7935
  * provides higher-level methods for working with catalog structures.
7871
7936
  */
7872
- getCatalog(): Promise<PdfDict | null>;
7937
+ getCatalog(): PdfDict;
7873
7938
  /**
7874
7939
  * Get all pages in document order.
7875
7940
  */
7876
- getPages(): Promise<PDFPage[]>;
7941
+ getPages(): PDFPage[];
7877
7942
  /**
7878
7943
  * Get page count.
7879
7944
  */
@@ -7882,7 +7947,15 @@ declare class PDF {
7882
7947
  * Get a single page by index (0-based).
7883
7948
  * Returns null if index out of bounds.
7884
7949
  */
7885
- getPage(index: number): Promise<PDFPage | null>;
7950
+ getPage(index: number): PDFPage | null;
7951
+ /**
7952
+ * Ensure page resources are resolved (not a reference).
7953
+ *
7954
+ * Pages may have Resources as a PdfRef pointing to a shared resources dict.
7955
+ * The sync getResources() method on PDFPage needs the actual dict, not a ref.
7956
+ * This resolves the reference and replaces it in the page dict.
7957
+ */
7958
+ private ensurePageResourcesResolved;
7886
7959
  /**
7887
7960
  * Add a new blank page.
7888
7961
  *
@@ -8075,7 +8148,7 @@ declare class PDF {
8075
8148
  * page.drawImage(image, { x: 50, y: 500 });
8076
8149
  * ```
8077
8150
  */
8078
- embedImage(bytes: Uint8Array): Promise<PDFImage>;
8151
+ embedImage(bytes: Uint8Array): PDFImage;
8079
8152
  /**
8080
8153
  * Embed a JPEG image into the document.
8081
8154
  *
@@ -8096,7 +8169,7 @@ declare class PDF {
8096
8169
  * });
8097
8170
  * ```
8098
8171
  */
8099
- embedJpeg(bytes: Uint8Array): Promise<PDFImage>;
8172
+ embedJpeg(bytes: Uint8Array): PDFImage;
8100
8173
  /**
8101
8174
  * Embed a PNG image into the document.
8102
8175
  *
@@ -8115,7 +8188,7 @@ declare class PDF {
8115
8188
  * page.drawImage(logo, { x: 100, y: 700, width: 150 });
8116
8189
  * ```
8117
8190
  */
8118
- embedPng(bytes: Uint8Array): Promise<PDFImage>;
8191
+ embedPng(bytes: Uint8Array): PDFImage;
8119
8192
  /**
8120
8193
  * Access the attachments API for managing file attachments.
8121
8194
  *
@@ -8144,7 +8217,7 @@ declare class PDF {
8144
8217
  *
8145
8218
  * @returns Map of attachment name to attachment info
8146
8219
  */
8147
- getAttachments(): Promise<Map<string, AttachmentInfo>>;
8220
+ getAttachments(): Map<string, AttachmentInfo>;
8148
8221
  /**
8149
8222
  * Get the raw bytes of an attachment.
8150
8223
  *
@@ -8153,7 +8226,7 @@ declare class PDF {
8153
8226
  * @param name The attachment name (key in the EmbeddedFiles tree)
8154
8227
  * @returns The attachment bytes, or null if not found
8155
8228
  */
8156
- getAttachment(name: string): Promise<Uint8Array | null>;
8229
+ getAttachment(name: string): Uint8Array | null;
8157
8230
  /**
8158
8231
  * Check if an attachment exists.
8159
8232
  *
@@ -8162,7 +8235,7 @@ declare class PDF {
8162
8235
  * @param name The attachment name
8163
8236
  * @returns True if the attachment exists
8164
8237
  */
8165
- hasAttachment(name: string): Promise<boolean>;
8238
+ hasAttachment(name: string): boolean;
8166
8239
  /**
8167
8240
  * Add a file attachment to the document.
8168
8241
  *
@@ -8173,7 +8246,7 @@ declare class PDF {
8173
8246
  * @param options - Attachment options (description, MIME type, dates)
8174
8247
  * @throws {Error} If name already exists and overwrite !== true
8175
8248
  */
8176
- addAttachment(name: string, data: Uint8Array, options?: AddAttachmentOptions): Promise<void>;
8249
+ addAttachment(name: string, data: Uint8Array, options?: AddAttachmentOptions): void;
8177
8250
  /**
8178
8251
  * Remove an attachment from the document.
8179
8252
  *
@@ -8182,7 +8255,7 @@ declare class PDF {
8182
8255
  * @param name The attachment name
8183
8256
  * @returns True if the attachment was removed, false if not found
8184
8257
  */
8185
- removeAttachment(name: string): Promise<boolean>;
8258
+ removeAttachment(name: string): boolean;
8186
8259
  /**
8187
8260
  * Check if the document has an interactive form (AcroForm).
8188
8261
  *
@@ -8230,7 +8303,7 @@ declare class PDF {
8230
8303
  * await pdf.save({ incremental: true });
8231
8304
  * ```
8232
8305
  */
8233
- getForm(): Promise<PDFForm | null>;
8306
+ getForm(): PDFForm | null;
8234
8307
  /**
8235
8308
  * Get or create the document's interactive form.
8236
8309
  *
@@ -8246,7 +8319,7 @@ declare class PDF {
8246
8319
  * const nameField = form.createTextField("name", { fontSize: 12 });
8247
8320
  * ```
8248
8321
  */
8249
- getOrCreateForm(): Promise<PDFForm>;
8322
+ getOrCreateForm(): PDFForm;
8250
8323
  /**
8251
8324
  * Sign the PDF document.
8252
8325
  *
@@ -8296,7 +8369,7 @@ declare class PDF {
8296
8369
  * }
8297
8370
  * ```
8298
8371
  */
8299
- hasLayers(): Promise<boolean>;
8372
+ hasLayers(): boolean;
8300
8373
  /**
8301
8374
  * Get information about all layers in the document.
8302
8375
  *
@@ -8313,7 +8386,7 @@ declare class PDF {
8313
8386
  * }
8314
8387
  * ```
8315
8388
  */
8316
- getLayers(): Promise<LayerInfo[]>;
8389
+ getLayers(): LayerInfo[];
8317
8390
  /**
8318
8391
  * Flatten all Optional Content Groups (layers) in the document.
8319
8392
  *
@@ -8343,7 +8416,7 @@ declare class PDF {
8343
8416
  * await pdf.sign({ signer });
8344
8417
  * ```
8345
8418
  */
8346
- flattenLayers(): Promise<FlattenLayersResult>;
8419
+ flattenLayers(): FlattenLayersResult;
8347
8420
  /**
8348
8421
  * Extract text from all pages in the document.
8349
8422
  *
@@ -8360,7 +8433,7 @@ declare class PDF {
8360
8433
  * }
8361
8434
  * ```
8362
8435
  */
8363
- extractText(): Promise<PageText[]>;
8436
+ extractText(): PageText[];
8364
8437
  /**
8365
8438
  * Search for text across all pages in the document.
8366
8439
  *
@@ -8383,7 +8456,7 @@ declare class PDF {
8383
8456
  * const placeholders = await pdf.findText(/\{\{\s*\w+\s*\}\}/g);
8384
8457
  * ```
8385
8458
  */
8386
- findText(query: string | RegExp, options?: FindTextOptions): Promise<TextMatch[]>;
8459
+ findText(query: string | RegExp, options?: FindTextOptions): TextMatch[];
8387
8460
  /**
8388
8461
  * Check if the document has unsaved changes.
8389
8462
  */