PDF forms with Radio Buttons Do Not Properly Save Properly, Resulting in Loss of User Input

The Problem

In the Preview app in macOS (or the Files app in iOS and iPadOS), when a user selects a radio button to "On", the radio button appears to behave as expected (with related radio buttons, sharing the same parent form field, appearing to turn "Off"). Also, as expected, the app indicates that the user has edited the PDF and, as such, is able to save and close the file as normal. On re-opening the file, the radio buttons seem to have been reset and user input lost.

What is Happening

Related radio button annotation widgets share the same parent form field. In the PDF 1.7 specification (ISO PDF32000-2008, s. 12.7.4.2.4), the parent form field object holds the field name property (T), the name object of the appearance state of the kid object currently selected (V), as well as an array of the references to the related radio button kid objects (Kids). Each kid object holds a reference to the parent object (Parent). When the user selects a radio button to be on, the V property is updated in the parent object accordingly.

On saving the PDF, an incremental update to the file is made with an updated copy of the kid object, corresponding to the selected radio box, created. The kid object created for the updated radio box, however, is updated incorrectly with the Parent object reference removed and the properties that ought to reside with the parent object (for V, T, and FT), instead, incorrectly written/merged into the kid object itself. The original parent object (belonging to the shared field form) is not updated with the incremental update in any way.

Impact on User Experience

Radio buttons are not functional, with user-input not properly saved. As such, using Preview to complete a PDF form with radio buttons is not possible. On re-opening the PDF, user input to the state of radio buttons appear not to have been saved.

Affected Apps/OSs:

Preview (macOS 12 and above) and Files (iOS 16 and iPadOS 16)

Related Sample of Code

Radio button annotation widget object (11 0 obj) and form field parent object (16 0 obj) in original PDF file:

11 0 obj
<<
	/Border [ 0 0 0 ]
	/Rect [ 433 405 453 425 ]
	/F 4
	/BS 13 0 R
	/Subtype /Widget
	/DA (/Helvetica 13 Tf 0 g)
	/MK 14 0 R /C [ 0 ]
	/AP 15 0 R /M (D:20230803164805Z00'00')
	/AS /Off
	/Parent 16 0 R
	/Type /Annot
	/Ff 32768
>>
endobj

16 0 obj
<<
	/V /
	/Kids [ 10 0 R 11 0 R ]
	/T (button2)
	/FT /Btn
>>
endobj

15 0 obj
<<
	/N 17 0 R
>>
endobj

17 0 obj
<<
	/Ted 18 0 R
	/Off 20 0 R
>>
endobj

Copy of object (11 0 obj) created with incremental update of PDF, included in saved file following user selection:

11 0 obj
<<
	/C [ 0 ]
	/FT /Btn
	/F 4
	/BS <<
		/W 0
	>>
	/Subtype /Widget
	/DA (//Helvetica 13 Tf 0 g)
	/Type /Annot
	/Border [ 0 0 0 ]
	/M (D:20230803164805Z00'00')
	/Rect [ 433 405 453 425 ]
	/MK <<
		/BG [ 0.75 ]
	>>
	/AP <<
		/N <<
			/Off 53 0 R
			/Ted 57 0 R
		>>
	>>
	/T (button2)
	/AS /Ted
	/Ff 32768
	/V /Ted
>>
endobj

A bug report, describing as much, was submitted to Apple (FB9978281).

Answered by omar_a in 769031022

The problem appears to have been fixed with macOS 14.0, iOS 17.0, and iPadOS 17.0.

To the unsung hero at Apple, who took the time to fix this, thank you!

Accepted Answer

The problem appears to have been fixed with macOS 14.0, iOS 17.0, and iPadOS 17.0.

To the unsung hero at Apple, who took the time to fix this, thank you!

PDF forms with Radio Buttons Do Not Properly Save Properly, Resulting in Loss of User Input
 
 
Q