pub struct OptionalContent {
pub groups: Vec<OptionalContentGroup>,
pub default_config: OcConfig,
pub alternate_configs: Vec<OcConfig>,
pub states: HashMap<ObjectId, bool>,
}Expand description
Full optional-content picture for a document.
Returned by DocumentReader::optional_content.
Fields§
§groups: Vec<OptionalContentGroup>Every OCG in the document, in /OCProperties /OCGs order.
default_config: OcConfigThe catalog’s /OCProperties /D configuration (always
present per §8.11.4.2 when /OCProperties itself is).
alternate_configs: Vec<OcConfig>Alternate configurations from /OCProperties /Configs.
states: HashMap<ObjectId, bool>Resolved state per group, after applying the default
configuration’s BaseState / ON / OFF (§8.11.4.5
algorithm). true ⇒ ON, false ⇒ OFF.
Implementations§
Source§impl OptionalContent
impl OptionalContent
Sourcepub fn is_visible(&self, group: ObjectId) -> bool
pub fn is_visible(&self, group: ObjectId) -> bool
Is this OCG visible under the default configuration? Returns
false for unknown ids (a content stream referencing an OCG
that isn’t in /OCProperties /OCGs is malformed; treat as
hidden).
Sourcepub fn states_for_config(&self, config: &OcConfig) -> HashMap<ObjectId, bool>
pub fn states_for_config(&self, config: &OcConfig) -> HashMap<ObjectId, bool>
Re-resolve states under an alternate configuration. Useful when
a PDF carries multiple /Configs (e.g. an engineering vs.
presentation layer setup) and the caller wants to switch.
Sourcepub fn evaluate_membership(&self, mem: &OcMembership) -> bool
pub fn evaluate_membership(&self, mem: &OcMembership) -> bool
Evaluate an OCMD’s visibility under the current default
configuration states. Surfaces the AllOn / AnyOn / AllOff /
AnyOff policy or the /VE visibility expression.
Returns true when no groups are referenced (per §8.11.2.2
“If this entry is not present, is an empty array, or contains
references only to null or deleted objects, the membership
dictionary shall have no effect on the visibility of any
content”).
Trait Implementations§
Source§impl Clone for OptionalContent
impl Clone for OptionalContent
Source§fn clone(&self) -> OptionalContent
fn clone(&self) -> OptionalContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more