pub fn layer_set_for(doc: &PdfDocument<'_>, intent: RenderIntent) -> LayerSetExpand description
Build a LayerSet that reflects the document’s default
configuration with every /AS automatic-state rule for the given
RenderIntent applied.
Algorithm:
- Start from
layer_set_from_document. - For each auto-state rule on the default configuration whose
/Eventmatches the requested intent:- For each OCG listed in the rule’s
/OCGs:- For each
/Categoryin the rule:- If that category’s
/Usagesub-dict on the OCG carries an explicit ON/OFF state, override that OCG’s entry in the LayerSet.
- If that category’s
- For each
- For each OCG listed in the rule’s
PDF spec doesn’t define precedence when multiple rules touch the
same OCG; this implementation is last-wins in the order rules
appear in /AS.
Layers carrying /Usage hints with no matching /AS rule are
untouched — by spec their hints are informational only, not
auto-applied. Some viewers heuristically apply them anyway; stet
does not.