CHAPTER 4
372
Graphics
<<
/Properties << /oc1 5 0 R >>
...
>>
5 0 obj
<<
/Type /OCG
/Name (Show Greeting)
>>
endobj
% In the resources dictionary
% This dictionary maps the name oc1 to an
% optional content group (object 5)
% The OCG controlling the visibility
% of the text.
The example above shows one piece of content associated with one optional con-
tent group. There are other possibilities:
•
More than one section of content can refer to the same group or membership
dictionary, in which case the visibility of both sections is always the same.
•
Equivalently, although less space-efficient, different sections can have separate
membership dictionaries with the same
OCGs
and
P
entries. The sections will
have identical visibility behavior.
•
Two sections of content can belong to membership dictionaries that refer to the
same group(s) but with different
P
settings. For example, if one section has no
P
entry, and the other has a
P
entry of
AllOff
, the visibility of the two sections of
content are opposite. That is, the first section is visible when the second is hid-
den, and vice versa.
The following example demonstrates both the direct use of optional content
groups and the indirect use of groups through a membership dictionary. The
content (a black rectangle frame) is drawn if either of the images controlled by
the groups named
Image A
or
Image B
is shown. If both groups are hidden, the
rectangle frame is hidden.
Example 4.36
% Within a content stream
...
/OC /OC2 BDC
0g
4w
100 100 412 592 re s
EMC
% Draws a black rectangle frame