Lossless Empty Choice Values in XFDF

A choice field can have no selected options, or it can select an option whose export value is the empty string; these states produce different PDF field values and must remain distinct during an export/import round trip

Empty selection and empty export value

HotPDF exports an empty value array with an explicit extension attribute in the https://www.loslab.com/hotpdf/xfdf/ namespace

<xfdf xmlns="http://ns.adobe.com/xfdf/" xmlns:hpdf="https://www.loslab.com/hotpdf/xfdf/">
  <fields>
    <field name="Choice" hpdf:empty-values="true"><value/></field>
  </fields>
</xfdf>

The attribute represents an empty array, so importing this field clears its selected options

An unmarked empty value retains its ordinary meaning: it represents the empty string and selects the matching empty export option when that option exists

<field name="Choice"><value/></field>

A field containing only its name retains the existing name-only behavior and does not become an explicit clear

Namespace and input validation

The importer identifies the extension by its expanded namespace name, so the prefix can differ from hpdf; an unqualified attribute or an attribute in another namespace does not request a clear

The extension value must be exactly true, with either no value element or one empty value element; conflicting nonempty values, repeated values and rich-text values are rejected

The namespace declaration and extension attribute count toward the existing object and byte budgets; cancellation and transaction checks remain in effect

Interoperability

This attribute is a HotPDF extension and is not an Adobe XFDF or ISO extension declaration; other consumers may ignore it and interpret the empty value according to their own behavior

Use a HotPDF-aware consumer when the distinction between no selection and an empty-string selection must survive a round trip

Native, job and callback APIs

The same representation applies to native form-data exchange and the existing Windows and Linux JSON/callback entry points; it adds no fields to the versioned V1 callback records

Windows form-data JSON limits use formData, while Linux form-data JSON limits use formDataLimits; use the documented key for the target API

An unchanged import preserves the original file bytes when there are no pending document edits; existing pending edits remain part of the prepared document, and publication retains the existing atomic output and authenticated permission checks

Related topics