I want to reference / edit embedded go-to action.

Community Beginner ,
Dec 18, 2018

Copy link to clipboard

Copied

Hello

I am creating an application in C ++ using Acrobat SDK.

In Japan, we developed d-LinkMaker (www.d-sols.com). However, there are still incomplete places.

I want to reference / edit embedded go-to action.

Please tell me how to read the file name of embedded document.

if (PDActionGetSubtype(pdAction) ==  ASAtomFromString( "GoToE" )){

     ASInt32 destPage;
     ASAtom fitType;
     ASFixedRect destRect;
     ASFixed zoom;

     PDViewDestination pdViewDest = PDActionGetDest(pdAction);

     if (PDViewDestIsValid(pdViewDest)) {

           PDViewDestGetAttr(pdViewDest, &destPage, &fitType, &destRect, &zoom);
      } else {

          *

          *

          *

     }

     //********************************************************

     PDFileSpec  filespec =  PDActionGetFileSpec(pdAction);      // No good

    

     CosObj  coAction =  PDActionGetCosObj(pdAction);
     CosObj  coFIL =  CosDictGet(coAction,  ASAtomFromString( "N" ));     // No good

     //*******************************************************************************

}

1 0 obj% Link to a child

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /C

/N (Embedded document) >>

>>

endobj

2 0 obj% Link to the parent

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /P >>

>>

endobj

3 0 obj% Link to a sibling

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /P

/T << /R /C

/N (Another embedded document) >>

>>

>>

endobj

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

The Acrobat SDK does not contain high level API objects and functions for every part of the spec. Instead it provides functions for manipulating the PDF at the low level, i.e. COS.  So your code needs to be a mix of the two. Use PDAction and PDNameTree APIs to get the objects of interest, the use COS to get at and modify the details of the specific objects.

TOPICS
Acrobat SDK and JavaScript

Views

280

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

I want to reference / edit embedded go-to action.

Community Beginner ,
Dec 18, 2018

Copy link to clipboard

Copied

Hello

I am creating an application in C ++ using Acrobat SDK.

In Japan, we developed d-LinkMaker (www.d-sols.com). However, there are still incomplete places.

I want to reference / edit embedded go-to action.

Please tell me how to read the file name of embedded document.

if (PDActionGetSubtype(pdAction) ==  ASAtomFromString( "GoToE" )){

     ASInt32 destPage;
     ASAtom fitType;
     ASFixedRect destRect;
     ASFixed zoom;

     PDViewDestination pdViewDest = PDActionGetDest(pdAction);

     if (PDViewDestIsValid(pdViewDest)) {

           PDViewDestGetAttr(pdViewDest, &destPage, &fitType, &destRect, &zoom);
      } else {

          *

          *

          *

     }

     //********************************************************

     PDFileSpec  filespec =  PDActionGetFileSpec(pdAction);      // No good

    

     CosObj  coAction =  PDActionGetCosObj(pdAction);
     CosObj  coFIL =  CosDictGet(coAction,  ASAtomFromString( "N" ));     // No good

     //*******************************************************************************

}

1 0 obj% Link to a child

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /C

/N (Embedded document) >>

>>

endobj

2 0 obj% Link to the parent

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /P >>

>>

endobj

3 0 obj% Link to a sibling

<< /Type /Action

/S /GoToE

/D (Chapter 1)

/T << /R /P

/T << /R /C

/N (Another embedded document) >>

>>

>>

endobj

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

The Acrobat SDK does not contain high level API objects and functions for every part of the spec. Instead it provides functions for manipulating the PDF at the low level, i.e. COS.  So your code needs to be a mix of the two. Use PDAction and PDNameTree APIs to get the objects of interest, the use COS to get at and modify the details of the specific objects.

TOPICS
Acrobat SDK and JavaScript

Views

281

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 18, 2018 0
Adobe Employee ,
Dec 19, 2018

Copy link to clipboard

Copied

GoToE actions are one place that you will need to do the heavy lifting yourself…

You can use PDActionGetDestinationName() to get the value of N from the Action dictionary – but then it’s entirely up to you to work with the EmbeddedFiles name tree to find the right one…

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Community Beginner ,
Dec 19, 2018

Copy link to clipboard

Copied

Thanks for the reply.

But what is PDActionGetDestinationName ()?

It is not found in the PDF Library API Reference.

Maybe, is there an Adobe PDF Library?

I am developing only with Acrobat DC SDK.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0
Most Valuable Participant ,
Dec 20, 2018

Copy link to clipboard

Copied

Maybe it's Adobe internal. Trivial to do anyway. The API which will save you a lot of work is PDNameTree.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 20, 2018 0
Adobe Community Professional ,
Dec 20, 2018

Copy link to clipboard

Copied

The Acrobat SDK does not contain high level API objects and functions for every part of the spec. Instead it provides functions for manipulating the PDF at the low level, i.e. COS.  So your code needs to be a mix of the two. Use PDAction and PDNameTree APIs to get the objects of interest, the use COS to get at and modify the details of the specific objects.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 20, 2018 0
Community Beginner ,
Dec 20, 2018

Copy link to clipboard

Copied

thank you everyone.

I understood how to do it.

test.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 20, 2018 1
Adobe Community Professional ,
Dec 19, 2018

Copy link to clipboard

Copied

I think Leonard is saying you need to use the COS level functions to get at and change the details.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2018 0