THPDFPage.AddTextField

THPDFPage

 

Methods  AcroForm Support

Adds an AcroForm text field widget to the current page

 

Delphi syntax:

procedure AddTextField(const FieldName, InitialValue: AnsiString; Rectangle: TRect; MaxLen: Integer = 0; Flags: THPDFFormFieldFlags = []);

 

Description

The method creates a /Tx field and registers it in the document AcroForm dictionary. Use Flags to enable text-field options such as multiline, password, comb, file-select, rich-text, scroll, and spell-check behaviour

With AutoFormAppearances on, which is the default, multiline text fields using valid UTF-8 within the canonical printable WinAnsi profile treat CR, LF and CRLF as explicit line separators and preserve intervening empty paragraphs in the generated appearance

Within each paragraph, wrapping measures the actual Helvetica advances of encoded characters, keeps whole words together when they fit and splits oversized words into fitting character spans; a trailing separator terminates the current paragraph without adding an extra trailing empty row

Comb appearances centre each encoded character by its actual Helvetica advance within its cell; PDF literal escapes do not contribute additional glyph width

This appearance layout preserves InitialValue, MaxLen, flags, viewport, font-size limits, leading and vertical placement; password masks continue to count valid Unicode scalars, and unsupported ordinary text or malformed multibyte input retains the existing empty-appearance fallback

 

See also: AcroForm Support, LastAnnotation