Copy link to clipboard
Copied
This is my code add a Rectangle to PDEElement:
AVRect rect;
PDEElementGetBBox (pdeElement, &bbox);
AVPageViewRectToDevice (pageView, &bbox, &rect);
sprintf(jsScript, "var a = this.addAnnot({page:%d,type:'Square'}); a.name='%s';a.rect=[%d,%d,%d,%d]; ",i,"P"+j, rect.left ,rect.top , rect.right, rect.bottom); AFExecuteThisScript (myPDDoc , jsScript, NULL);
Position of Rectangle in Result not correct.
How can get coordinates of PDEElement?
Thanks all.
Why are you converting to device rects. Skip that step and you should be fine.
BUT if you are already using the C++ APIs, why switch to JavaScript? Why not do all this using PD calls such as PDPageAddAnnot?
Copy link to clipboard
Copied
Why are you converting to device rects. Skip that step and you should be fine.
BUT if you are already using the C++ APIs, why switch to JavaScript? Why not do all this using PD calls such as PDPageAddAnnot?
Copy link to clipboard
Copied
I'm sorry, I had try this code and it add ok, but not exist color, so i can't see rectangle.
PDAnnot annot;
//Create a PDAnnot object
annot = PDPageCreateAnnot (pdPage, ASAtomFromString("Square"),&bbox);
PDPageAddAnnot(pdPage,-2, annot);
How set boder color of rectangle?
Copy link to clipboard
Copied
Thanks, i had can set boder color , found at https://forums.adobe.com/thread/1517372?q=change%20color
Copy link to clipboard
Copied
You are looking at the values as floating point – but they are NOT, they are Fixed (ASFixed). If you look at them as fixed point, they will be fine.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now