Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Re: Create new tag for selected text using API?

$
0
0

As per sample of snippetRunner for adding tag for selected text.

I tried below code

PDPage pg;

AVDoc avDoc = AVAppGetActiveDoc();

PDDoc pd = AVDocGetPDDoc(avDoc);

    pg = PDDocAcquirePage(pd, 0);

ASAtom theSelectionType = AVDocGetSelectionType(avDoc);

if (theSelectionType == ASAtomFromString("Text")){

    PDTextSelect ts = static_cast<PDTextSelect>(AVDocGetSelection(avDoc));

    PDSTreeRoot pdsTreeRoot;

    CosObj pageObj = PDPageGetCosObj (pg);

    PDSElement newElem;

    PDSElementCreate(pd, &newElem);

    char buf1[64];

    strcpy (buf1, "A new structure element");

    // set its type as "Document" standard type

    PDSElementSetType(newElem, ASAtomFromString ("Document"));

    // set its title

    PDSElementSetTitle(newElem, reinterpret_cast<const ASUns8*> (buf1), strlen(buf1));

    PDSTreeRootInsertKid (pdsTreeRoot, aElem, kPDSAfterLast);

    PDSElementInsertMCAsKid // here something i have to add

}

If i have PDTextSelect how i can add tag for selected text.like user add tag using "CreateTagForSelectedText" option.

please,help me.

 

thanks.


Viewing all articles
Browse latest Browse all 10848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>