Previous Next


                                         367
SECTION 4.10                                                           Optional Content



Note: Since the VE entry is more general, if it is present and supported by the PDF
consumer software, it should be used in preference to OCGs and P. However, for
compatibility purposes, PDF creators should use OCGs and P entries where possible.
When the use of VE is necessary to express the intended behavior, OCGs and P en-
tries should also be provided to approximate the behavior in older consumer soft-
ware.

A visibility expression is an array with the following characteristics:

• Its first element is a name representing a boolean operator (And, Or, or Not).
• Subsequent elements are either optional content groups or other visibility ex-
  pressions.
• If the first element is Not, it should have only one subsequent element. If the
  first element is And or Or, it may have one or more subsequent elements.
• In evaluating a visibility expression, the ON state of an optional content group is
  equated to the boolean value true; OFF is equated to false.

Examples 4.33 and 4.34 illustrate the use of visibility expressions.

Membership dictionaries are useful in cases such as these:
• Some content may choose to be invisible when a group is ON and visible when it
  is OFF. In this case, the content would belong to a membership dictionary
  whose OCGs entry consists of a single optional content group and whose P en-
  try is AnyOff or AllOff.
  Note: It is legal to have an OCGs entry consisting of a single group and a P entry
  that is AnyOn or AllOn. However, in this case it is preferable to use an optional
  content group directly because it uses fewer objects.
• Some content may belong to more than one group and must specify its policy
  when the groups are in conflicting states. In this case, the content would belong
  to a membership dictionary whose OCGs entry consists of an array of optional
  content groups and whose P entry specifies the visibility policy, as illustrated in
  Example 4.32 below. (Example 4.33 shows the equivalent policy using visibility
  expressions.)

Previous Next