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.