Skip navigation
Currently Being Moderated

How to set action of a link to "Set Layer Visibility" via plugin?

Sep 5, 2012 2:55 AM

Hi

 

I have few shapes in a pdf document which are linked to some layers. I need to update the links according to the object data of a particular shape. I am able to get the object data but I am not able to set the link action. Please guide.

 

Thanks..

 
Replies
  • Currently Being Moderated
    Sep 5, 2012 4:32 AM   in reply to poortip87

    What seems to be the problem?

     

    Create the action (PDAction) and assign it to the Link annot.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 2:16 AM   in reply to poortip87

    You need to know that "layer" is just what the UI calls "optional content" (=optional content group, =OCG).

     

    Now refer to 12.6.4.12 in the PDF specification.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 3:19 AM   in reply to poortip87

    If you can do something in the UI you can always do it in the plug-in API (with very few exceptions, e.g. Reader enabling which relies on proprietary techniques). Sometimes it is easy, sometimes not.

     

    The PDF Specification describes the format needed for the action object. Personally I would take that information, and make a Cos object, then use the Cos object as an action.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 4:02 AM   in reply to poortip87

    The principle looks good. Let's look at what gets created.

     

    onArray: [ /ON ocg null ]   -- why the null?

    onObj: << /State onarray >>  -- I guess we probably inherit the necessary S entry

     

    I see that PDOCGCreate is supposed to create a new OCG entry. Is that right? And if so, where do you assign content to that group. PDOCGCreate does not seem to be for obtaining a PDOCG for an existing OCG, if that is what you wanted to do.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points