Skip to main content
Known Participant
Mar 10, 2017 1:41 PM UTC
Answered

How do you get a draw rectangle to stay displayed

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?

This topic is closed to new replies. Start a new post to keep the conversation going.
Dan_Korn
Dan_KornCorrect answer
Inspiring
Mar 10, 2017 8:38 PM UTC

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.

7 replies

lrosenth
Adobe Employee
Adobe Employee
Mar 10, 2017 2:20 PM UTC

Something that is part of the PDF itself? Look at the PDEdit layer of APIs

Translate
LWShayAuthor
Known Participant
Mar 10, 2017 2:26 PM UTC

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);

Translate
lrosenth
Adobe Employee
Adobe Employee
Mar 10, 2017 2:59 PM UTC

You will have ot redraw the rect as the view changes then…

Translate