Highlighted

Acrobat SDK - AVPageViewAcquireDrawContext problem in Acrobat DC

Explorer ,
Nov 11, 2020

Copy link to clipboard

Copied

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(). 

 

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

port is acquired. 

@Param 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 

TOPICS
Acrobat SDK and JavaScript

Views

18

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Acrobat SDK - AVPageViewAcquireDrawContext problem in Acrobat DC

Explorer ,
Nov 11, 2020

Copy link to clipboard

Copied

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(). 

 

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

port is acquired. 

@Param 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 

TOPICS
Acrobat SDK and JavaScript

Views

19

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2020 0
Most Valuable Participant ,
Nov 11, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 11, 2020 0
Explorer ,
Nov 11, 2020

Copy link to clipboard

Copied

 

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.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 11, 2020 0