Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 87055

Re: How to change the color of text highlight

$
0
0

After suggestions, I did these changes to the code. I'm still not getting the highlight annotation. It seems like I'm doing something wrong at the last couple of lines from  PDAnnotNotifyDidChange. Getting an error, saying there was a problem reading this document.

 

PDTextSelect textSelection = PDTextSelectCreateWordHilite(pdPage,&hilite, 1);

AVDocSetSelection(currentAVDoc, ASAtomFromString("Text"),(void *)textSelection, true);

AVPageViewDrawNow(currentPageView);

AVDocShowSelection (currentAVDoc);

 

PDTextSelect selectedText = static_cast<PDTextSelect>(AVDocGetSelection(currentAVDoc));

PDTextSelectGetBoundingRect(selectedText, &boundingRect);

 

  CosObj ArrayObj, RecObj, cosDict;

  CosDoc cd = PDDocGetCosDoc(currentPDDoc);

  ArrayObj = CosNewArray(cd,false,8);

 

  RecObj = CosNewFixed(cd,false, boundingRect.left);

  CosArrayPut(ArrayObj,0,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.bottom);

  CosArrayPut(ArrayObj,1,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.right);

  CosArrayPut(ArrayObj,2,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.bottom);

  CosArrayPut(ArrayObj,3,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.right);

  CosArrayPut(ArrayObj,4,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.top);

  CosArrayPut(ArrayObj,5,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.left);

  CosArrayPut(ArrayObj,6,RecObj);

  RecObj = CosNewFixed(cd,false, boundingRect.top);

  CosArrayPut(ArrayObj,7,RecObj);

 

 

  ASAtom QuadPoints_K = ASAtomFromString("QuadPoints");

  CosDictPut(cosDict,QuadPoints_K,ArrayObj);

  PDAnnotNotifyDidChange( PDAnnotFromCosObj(cosDict), ASAtomFromString( "Highlight" ), 0 );

  //pdAnnot = PDAnnotFromCosObj(cosDict);

  //pdAnnot = PDPageAddNewAnnot(pdPage, -2, ASAtomFromString("Highlights"), &ArrayObj);

  //AVPageViewRectToDevice(currentPageView, &boundingRect, &viewRect);

  PDAnnotSetColor(pdAnnot, &red);

  //AVPageViewInvalidateRect(currentPageView, &viewRect);

   

  // Force redraw of page.

  AVPageViewDrawNow (currentPageView);

  PDPageRelease (pdPage);


Viewing all articles
Browse latest Browse all 87055

Trending Articles



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