AddTextField(String, PdfPage, PdfRectangle, PdfFieldOptions?) Method

Definition

Namespace Broadside.Forms
Assembly Broadside.dll

Creates a text field with one widget on page.

public PdfTextField AddTextField(string name, PdfPage page, PdfRectangle rectangle, PdfFieldOptions? options = null)

Parameters

name
String

The field's fully qualified name: partial names joined by periods. Ancestors that do not exist are created as non-terminal fields.

page
PdfPage

The page the widget is on, a page of this form's document.

rectangle
PdfRectangle

The widget's rectangle, in default user space.

options
PdfFieldOptions

The field's flags, text appearance and widget colours; null for the defaults.

Returns

PdfTextField
The new field, with no value; set one with SetValue(String?).

Remarks

ISO 32000-2 §12.7.4 and §12.7.5.3. The field (FT Tx) is merged with its widget annotation (Table 226, Kids) and added to its parent's Kids or the form's Fields, the widget to the page's Annots, with P, the Print flag, and MK and BS from the options (§12.5.6.19). The field gets its own default appearance (DA: the options' size and colour in the form's Helvetica) and the form's default resources get Helvetica and ZapfDingbats when they lack them (§12.7.3, Table 224, DR, DA).

Every widget gets an appearance stream, as GenerateAppearances() makes it, so the form needs no NeedAppearances. Text the form's Helvetica cannot show is drawn in an embedded subset font. When any step fails the document is left as it was. Creating a form field raises a save of a document below PDF 1.2 to 1.2, and the PDF 1.3 to 1.5 entries and flags raise it further. A mutation: no read may run concurrently with it.