3 Replies Latest reply: Sep 2, 2008 6:06 AM by (Aandi_Inston) RSS

    Need help with PDDocEnumOCGs

    andrejusc Community Member
      Hi,
      I'd like to enumerate available layers inside PDF document and what elements belong to each one. For layers enumeration I think I could use PDDocEnumOCGs call, but how to determine what elements are inside particular layer?

      I'm using Adobe SDk 7.0.5 and Adobe Professional 7.0.8 for my plugin testing.

      Any help would be appreciated!
        • 1. Re: Need help with PDDocEnumOCGs
          Community Member
          That call returns you the optional content groups, which is the dictionary that contains the information such as

          Required
          Type - Must be "OCG"
          Name - Name (as displayed to the user)

          Optional
          Intent - what the groups intent is (normally "View" or "Design")
          Usage - Controls the state of the group.

          This dictionary does not contain information on what content is contained in a OCG, you should read 4.10 of the PDF reference and it will explain how to find which elements are included in a OCG.

          HTH

          Malky
          • 2. Re: Need help with PDDocEnumOCGs
            andrejusc Community Member
            In that mentioned 4.10 we have:

            "Individual content elements in a document specify the optional content group or
            groups that affect their visibility (see Section 4.10.2, Making Graphical Content
            Optional). Any content whose visibility can be affected by a given optional content
            group is said to belong to that group."

            Does it mean that during enumeration of content elements I need additionally check their belonging to OCG? What API call should I use for that? Is it PDEElementGetOCMD?

            Thanks in advance!
            • 3. Re: Need help with PDDocEnumOCGs
              (Aandi_Inston) Community Member
              >Does it mean that during enumeration of content elements I need additionally check their belonging to OCG?

              Yes. There is no path from OCG to a list of elements; just elements
              may belong to an OCG. If there were to be an "enumerate elements in
              OCG" call, it would have to be done as "enumerate all elements; check
              membership; return if included".

              I don't know if there is a specific PDFEdit API, or whether you just
              have to track property lists.

              Aandi Inston