XFA Code128 Fields
Version 2.1165.0 adds exact non-ASCII byte encodings through FNC4, including strict UTF-8, Latin1 and UTF-16 payloads without changing the original field value or legend
Version 2.1164.0 generates native vector barcodes for XFA fields whose UI type is code128, code128A, code128B or code128C, using case-insensitive type names
The field retains its value and authored layout position; generated PDF output contains real bars, mandatory symbol checksum and stop pattern, with white quiet zones and a supplied-font legend when requested
Template input
<field name="Inventory" x="20pt" y="20pt" w="240pt" h="50pt">
<ui><barcode type="code128" dataLength="16" textLocation="below"/></ui>
<font typeface="Arial" size="10pt"/>
<value><text>ABC123</text></value>
</field>
Use HPDFXFAWriteHeadlessPDF with a real supplied TrueType font for headless output, or the component's FlattenLoadedXFA path for loaded XFA documents; the barcode primitives remain in the core source layer
Geometry and legends
Supply a positive absolute moduleWidth or a positive dataLength; explicit module width takes precedence, while data length determines a stable narrow-bar scale from the field width
Data length is a sizing hint rather than a payload length limit; longer content keeps its module widths and expands the generated appearance and PDF widget rectangle to contain the complete symbol, without moving subsequent layout objects
An optional absolute moduleHeight controls bar height; otherwise the field height, less any legend, supplies the available height
textLocation defaults to below and also accepts above and none; embedded-above and embedded-below requests use their corresponding external legend positions
The legend uses actual font metrics and centers within the visual appearance; an empty value produces an empty appearance, while encoded control bytes require textLocation="none"
Runtime edits and detached appearances
TXFAWidgetRuntime exposes xwkBarcode and its effective BarcodeStyle metadata, preserving existing widget-kind ordinal values; ordinary focus, selection, edit, commit and rollback APIs remain available
After a successful edit, use SaveToBytes and regenerate through the headless writer or SetXFADocument plus the component flatten path to refresh the actual barcode appearance; failed transactions retain the previously committed XDP state
The canvas presentation paints barcode bars outside editing mode and presents the value as editable text during editing; this release's automated acceptance does not run GUI painting
HPDFXFACode128Runs(Value, Symbology, MaxCharacters, CancellationToken) returns alternating dark/light run widths for bounded custom consumers; HPDFXFABuildBarcodeAppearance returns a detached THPDFXFAButtonAppearance graph for callers that adopt its objects and resources
Encoding boundaries
Automatic Code128 selects and switches sets A and B for all byte values through FNC4; explicit A accepts bytes 0–95 and 128–223, explicit B accepts bytes 32–127 and 160–255, and explicit C requires an even number of ASCII decimal digits
The selected character encoding is applied explicitly before bar generation; compression, encrypted payloads and optional start/end control characters remain outside this profile, and unsupported requests fail before a prepared headless candidate reaches the destination
Version 2.1179.0 also supports Code39 and Extended Code39 fields; other barcode symbologies retain their existing fallback warning and read-only text behavior; this field implementation does not change the separate static draw/barcode path or add viewer-side barcode JavaScript to flattened AcroForm fields
Input, glyph-unit, object, output-byte and cancellation limits apply to barcode generation and detached adoption; destination-stream write failures retain that stream's normal partial-write semantics
Native XFA PDF creation · Widget runtime · Focused acceptance evidence (Tests/XFA/BarcodeFields/Readme.en-us.md)