At PDF week, I think Roman described three variations of derived HTML. If we were to give them names they could be: "HTML Equivalent", "Storage Format", "Logical Model". I'll try describing them here -- along with some commentary.
HTML Equivalent
Translate to the nearest HTML equivalent tags and attributes. Create <input>
, <textarea>
, <select>
etc instead of custom components. Use HTML properties instead of data-*
properties where possible.
For the most part, I think HTML-equivalent is difficult -- for reasons previously discussed. It is also the format that is the most effort for derivation to produce.
Storage Format
Field information would be described using data attributes mimicking the same properties as found in the source PDF. For example, field flags are sent as a single data-pdf-ff
property
The advantage to this style is that derivation is very easy. The disadvantage is that we need to do the storage-to-logical-model processing in JavaScript.
Logical model
Translate to properties that are aligned with the logical model defined in Forms.Next.
The logical model objects/properties are very similar to the Acroforms Field Object and field properties.
Producing HTML that maps to the logical model means data-*
attributes support for each of the roughly 50 field properties described in section 3.10 of the draft Forms.Next specification.
Some properties are dictionaries, and we have a choice to either send the entire dictionary as a JSON blob, or we can split the dictionary into individual properties.
e.g., the events dictionary could be one property: data-pdf-events
or could be multiple properties: data-pdf-events-change
, data-pdf-events-click
etc. Applies also to the constraints, formats and custom dictionaries.
Of course, we could go the other direction and encode the entire set of logical model properties as a JSON blob under a single data-pdf-field-properties
attribute.
The advantage of the logical model, is that it maps directly from what a host form processor has in memory and directly to what a responsive mode form processor will support. i.e., if field properties are encoded in any other manner, they have to be translated to the logical model by the responsive mode client.