Skip to content

Kernel forms: a text field with Multiline clear is written with a line break in its value #774

Backlog

Description

@Tim81

Why

ISO 32000-1, Table 228, bit 13 (ISO 32000-2, Table 231): "if clear, the field's text shall be restricted to a single line".

Measured on origin/main b2791ba, no claim, AddTextField(page, "t", rect, "a\nb") then Save: the widget has /Ff 0 and /V (a\nb) (a line feed inside the literal string), and the appearance draws the string in one Tj with the line feed escaped as \n. FormFieldOptions.Multiline is the only way to set bit 13 and nothing links it to the value. With Multiline = true the same value saves, and the appearance still draws one line (that is the layout limit of #715, not this issue).

Sweep: only the text field has the flag; the choice field and push button write no multi-line value, and the other seven packages write no text field.

Proposal

Refuse a value with a line feed or carriage return, when Multiline is false, at the AddTextField call, with ArgumentException (ParamName value), or set Multiline for such a value; the first matches "new refusals only where 2.3.3 wrote an invalid file". Document it on AddTextField and on FormFieldOptions.Multiline.

Acceptance

  • The skipped test ConformanceAuditG6Tests.Iso32000_1_12_7_4_3_ASingleLineFieldHoldsNoLineBreak runs and passes, and the pin Iso32000_1_12_7_4_3_PinsTodayALineBreakInTheValueOfASingleLineFieldIsWritten is replaced.
  • A value with no line break, and a multi-line field with one, keep their bytes.

Activity

  1. added
    bug
    on Nov 29, 2026
  2. Tim81 commented on Nov 29, 2026

    @Tim81
    OwnerAuthor

    Two additions from the review of the audit PR.

    Ground. ISO 32000-1, 12.7.4.3 adds to Table 228: "A conforming PDF file, and a conforming processor shall obey the usage guidelines in Table 228". So the line in the Multiline row, "if clear, the field's text shall be restricted to a single line", binds the file.

    The set of line breaks. The issue's acceptance names the line feed. Measured on origin/main b2791ba, no claim, AddTextField with a + each character + b as the value, Multiline clear: U+000A, U+000B, U+000C, U+000D and U+0085 are written to /V and the appearance (the control codes as their byte, U+0085 as UTF-16BE), and U+2028 and U+2029 are refused at the save by the appearance font (not a WinAnsi character). The skipped test ConformanceAuditG6Tests.Iso32000_1_12_7_4_3_ASingleLineFieldHoldsNoLineBreak now covers LF, VT, FF, CR, NEL, LS and PS, so a fix that strips only LF and CR fails it. Say in the acceptance which of these the fix refuses or removes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions