Skip to main content

apply_choice_multi

Function apply_choice_multi 

Source
pub fn apply_choice_multi(
    doc: &mut Document,
    name: &str,
    values: &[String],
) -> Result<WriteOutcome, WritebackError>
Expand description

Set multiple selected values on a multi-select list box (/Ff bit 22).

Writes /V as an array of text strings and rebuilds /I as the sorted, de-duplicated zero-based indices of the selected values within /Opt (PDF 32000-1 §12.7.4.4 — Acrobat writes both, and a consistent /I drives correct visual selection in viewers that honour it, disambiguating duplicate display strings). Per-option highlight appearance is viewer-native, so /NeedAppearances is set rather than synthesising an /AP.

Rejects read-only fields, non-choice fields, single-select list boxes, and (for non-editable fields) values absent from /Opt. Passing an empty values slice clears the selection (/V becomes an empty array and /I is removed).