PXC_Inst ActiveX Object

From PDF XChange PDF SDK
Jump to: navigation, search
Line 61: Line 61:
 
and there you have only two ways to get access to it:
 
and there you have only two ways to get access to it:
  
* '''A.''' By using '''CoCreateInstance'''. For example, in C#:
+
* '''A.''' by using '''CoCreateInstance'''. For example, in C#:
 
<pre class="brush:cpp;gutter:false">
 
<pre class="brush:cpp;gutter:false">
 
AxPDFXEdit.AxPXC_Inst pdfCoreInst = AxPDFXEdit.AxPXC_Inst();
 
AxPDFXEdit.AxPXC_Inst pdfCoreInst = AxPDFXEdit.AxPXC_Inst();
 
</pre>
 
</pre>
  
* '''B.''' By getting pointer to [[PXV:IPXC_Inst|IPXC_Inst]] interface as extension. For example, in C++:
+
* '''B.''' by getting pointer to [[PXV:IPXC_Inst|IPXC_Inst]] interface as extension. For example, in C++:
 
<pre class="brush:cpp;gutter:false">
 
<pre class="brush:cpp;gutter:false">
 
AxPDFXEdit.IPXV_Inst pdfInst;
 
AxPDFXEdit.IPXV_Inst pdfInst;

Revision as of 18:48, 1 June 2015


Overview

The main ActiveX Object of PDF-XChange Core API SDK that provides part of general functionality to work with PDF and gives access to an additional extensions of SDK.

The GUID of object is:

{D37FFAC6-B7ED-441E-B933-19B4E57FCB60}

The interface of control is:

IPXC_Inst

How to Instantiate

You may instantiate the object in standard way by using the CoCreateInstance function or by any other method that is appropriate for instantiating of regular ActiveX-objects in your programming language.

For example, in C#:

AxPDFXCoreAPI.AxPXC_Inst pdfInst = new AxPDFXCoreAPI.AxPXC_Inst();

In VB6:

Dim pdfInst As PDFXCoreAPI.PXC_Inst
...    
Set pdfInst = New PDFXCoreAPI.PXC_Inst

In C++:

CComPtr<IPXC_Inst> spPDFInst;
HRESULT hr = CoCreateInstance(__uuidof(PXC_Inst), nullptr, CLSCTX_INPROC_SERVER, __uuidof(IPXC_Inst), (void**)&spPDFInst);

Also, exists other special way to get pointer to IPXC_Inst interface. For example, in C++:

typedef HRESULT (__cdecl *t_pPXC_GetInstance)(IPXC_Inst** ppInst);

#if defined _M_IX86
#define SDK_LIB_NAME	L"PDFXCoreAPI.x86.DLL"
#else
#define SDK_LIB_NAME	L"PDFXCoreAPI.x64.DLL"
#endif

CComPtr<IPXC_Inst> spPDFInst;
HMODULE hSDKLib = LoadLibrary(SDK_LIB_NAME);
t_pPXC_GetInstance pfn = (t_pPXC_GetInstance)GetProcAddress(hSDKLib, "PXC_GetInstance");
HRESULT hr = pfn(&spPDFInst);

- with this special method you will be able to use SDK without regular installation as COM-server on client machine.

NOTE: in context of PDF-XChange Editor SDK this object has different GUID:

{77E64401-E3E8-4049-A630-0434E69586AA}

and there you have only two ways to get access to it:

  • A. by using CoCreateInstance. For example, in C#:
AxPDFXEdit.AxPXC_Inst pdfCoreInst = AxPDFXEdit.AxPXC_Inst();
  • B. by getting pointer to IPXC_Inst interface as extension. For example, in C++:
AxPDFXEdit.IPXV_Inst pdfInst;
...
AxPDFXEdit.IPXC_Inst pdfCoreInst = (AxPDFXEdit.IPXC_Inst)pdfInst.GetExtension("PXC");

The same in C++:

CComPtr<IPXV_Inst> spPDFInst;
...
CComPtr<IUnknown> spUnk;
spPDFInst->GetExtension(CComBSTR(L"PXC"), &spUnk);
CComQPtr<IPXC_Inst> spPDFCoreInst = spUnk;


How to Use

If PDF-XChange Core API SDK is used, it must be initialized by call IPXC_Inst::Init method and should be finalized by call IPXC_Inst::Finalize method. These method will have no effect in PDF-XChange Editor SDK.