Skip to main content
Inspiring
November 11, 2020
Question

Acrobat SDK - AVPageViewAcquireDrawContext problem in Acrobat DC

  • November 11, 2020
  • 1 reply
  • 553 views

Please see the Windows comment In AVProcs.h below:

/**

Acquires the platform-specific object needed to draw into 

the Acrobat viewer's document window using a platform's 

native graphics calls. When done, release the context using AVPageViewReleaseDrawContext(). 

 

@9397041 pageView IN/OUT The AVPageView whose platform-dependent 

port is acquired. 

@9397041 contextType IN See DrawContextType definition in AVExpT.h

@Return A platform-dependent value:

 

 

<TABLE rules="all" cellspacing="1">

<TR><TH>Operating system</TH><TH>Value</TH></TR>

<TR><TD>Mac OS</TD><TD><code>GrafPtr</code>.</TD></TR>

<TR><TD>Windows</TD><TD><code>WinPort</code>.</TD></TR>

<TR><TD>UNIX</TD><TD><code>Widget</code>.</TD></TR>

</TABLE>

 

 

@SEE AVPageViewReleaseMachinePort 

@Since PI_ACROVIEW_VERSION >= 0x000A0000

*/

NPROC(void *, AVPageViewAcquireDrawContext, (AVPageView pageView, DrawContextType contextType))

 

 

However the definition of DrawContextType is:

typedef enum _t_DrawContextType {

#if WIN_PLATFORM

/** Windows only: HWND */

kWinHWNDType,

/** Windows only: HDC */

kWinHDCType

#endif

#if MAC_PLATFORM

/** Mac only: CGContext */

kMacCGContextType

#endif

#if UNIX_PLATFORM

/** Unix only: Widget */

kUnixWidgetType

#endif

 

 

} DrawContextType;

 

 

How should this value be passed into AVPageViewAcquireDrawContext. I have tried as individual values called twice to get the HWND and HDC and doing an or of kWinHWNDType and kWinHDCType. I am doing a port of a plug-in built for earlier versions of Acrobat that was using AVPageViewAcquireMachinePort which has now been depreciated 

This topic has been closed for replies.

1 reply

Legend
November 11, 2020

Please show a line you've tried and describe the result (compile error, crash, zero return, unusable return,,,?)

Inspiring
November 11, 2020

 

HWND myhWnd = (HWND)AVPageViewAcquireDrawContext(avPageView, DrawContextType::kWinHWNDType);

 

//This returns a null window handle.

 

HDC myhDC = (HDC)AVPageViewAcquireDrawContext(avPageView, DrawContextType::kWinHDCType);

 

//This returns a null HDC handle.

 

WinPort mywinport = (WinPort)AVPageViewAcquireDrawContext(avPageView, DrawContextType::kWinHDCType);

 

//This returns a null WinPort handle.

 

WinPort winport = (WinPort)AVPageViewAcquireDrawContext(avPageView, DrawContextType::kWinHWNDType);

 

//This returns a null WinPort handle.