Copy link to clipboard
Copied
I drew a rectangle on a document using the function AVPageViewDragOutNewRect, however, the rectangle flashes on the screen for a second and then disappears. How do I go about getting he rectangle to remain showing?
Your code itself looks fine, but where are you calling it from? You should do drawing only during one of the drawing callbacks, i.e. a handler for AVAnnotHandlerDrawProc or AVAnnotHandlerDrawExProc., or a function passed to AVAppRegisterForPageViewDrawing.
Copy link to clipboard
Copied
Something that is part of the PDF itself? Look at the PDEdit layer of APIs
Copy link to clipboard
Copied
I actually don't need the rectangle to be apart of the PDF itself. I just want it to remain displayed on the page and get the AVFixedRect associated with it. As of right now I can get the rectangle but I can't get it to stay. Here is a sample code.
AVPageViewDragOutNewRect(pageView,xHit,yHit,&resultRect);
ASFixedRect fixedRect;
AVPageViewDeviceRectToPage(pageView,&resultRect,&fixedRect);
AVPageViewGhostRectOutline(pageView, &resultRect);
AVPageViewInvalidateRect(pageView, &resultRect);
AVPageViewDrawNow (pageView);
AVPageViewDrawRect(pageView, &resultRect);
Copy link to clipboard
Copied
You will have ot redraw the rect as the view changes then…
Copy link to clipboard
Copied
As of right now I'm not changing the view, however, the rectangle still disappears.
Copy link to clipboard
Copied
Your code itself looks fine, but where are you calling it from? You should do drawing only during one of the drawing callbacks, i.e. a handler for AVAnnotHandlerDrawProc or AVAnnotHandlerDrawExProc., or a function passed to AVAppRegisterForPageViewDrawing.
Copy link to clipboard
Copied
I'm calling it from a DoClick function
Copy link to clipboard
Copied
When you draw a rectangle - remember, this is not static PDF content, it's just information you draw in the UI - it will stay on the screen until Acrobat sees a need to redraw the page. This can be because you are scrolling, zooming, or doing anything else with the user interface, but it can also be because Acrobat, or some other plug-in decides that it's time to redraw the screen, without any user interaction. You need to keep track of these redraw operations, and then draw your rectangle again (in the correct position). Take a look at the callbacks that Dan provided. I have not done this particular operation in a while, but if I remember correctly I registered for the AVPageViewDidChange and AVPageViewDidDraw callbacks.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now