MCPcopy Create free account
hub / github.com/LibPDF-js/core / getForm

Method getForm

src/api/pdf.ts:2645–2660  ·  view source on GitHub ↗

* Get the document's interactive form. * * Returns null if no form exists. The form is loaded lazily on first call * and cached for subsequent calls. * * @returns The form, or null if no form exists * * @example * ```typescript * const form = await pdf.getForm(); * if (

()

Source from the content-addressed store, hash-verified

2643 * ```
2644 */
2645 getForm(): PDFForm | null {
2646 // If catalog has changed since last load, invalidate form cache
2647 if (this._form !== undefined) {
2648 const catalog = this.ctx.catalog.getDict();
2649
2650 if (catalog.dirty || !catalog.has("AcroForm")) {
2651 this._form = undefined;
2652 }
2653 }
2654
2655 if (this._form === undefined) {
2656 this._form = PDFForm.load(this.ctx);
2657 }
2658
2659 return this._form;
2660 }
2661
2662 /**
2663 * Get or create the document's interactive form.

Calls 3

getDictMethod · 0.65
hasMethod · 0.45
loadMethod · 0.45

Tested by 1

loadTaggedFormFunction · 0.64