An OCG object represents an optional content group in a PDF file. Content in the file can belong to one or more optional content groups. Content belonging to one or more OCGs is referred to as optional content and its visibility is determined by the states (ON or OFF) of the OCGs to which it belongs. In the simplest case, optional content belongs to a single OCG, with the content being visible when the OCG is on and hidden when the OCG is off. More advanced visibility behavior can be achieved by using multiple OCGs and different visibility mappings.
Use the Doc getOCGs method to get an array of OCG objects for a PDF document.
The Doc methods addWatermarkFromFile and addWatermarkFromText add watermarks in an OCG.
See the