Skip to main content
Known Participant
March 10, 2017
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
March 10, 2017

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
March 10, 2017

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

Translate
LWShayAuthor
Known Participant
March 10, 2017

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
March 10, 2017

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

Translate