PXC_Inst ActiveX Object

From PDF XChange PDF SDK
Jump to: navigation, search

Overview

The main ActiveX Object of the PDF-XChange Core API SDK that provides much of the general functionality available to work with a PDF file and offers access to additional extensions of the SDK.

The object GUID is:

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

The interface of the control is:

IPXC_Inst

How to Instantiate

You usual way to instantiate the object is to use the CoCreateInstance function, however there maybe a more appropriate means instantiate an ActiveX-object in your preferred programming language and if so, this may be used.

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

There exists another special way to get a pointer to the IPXC_Inst interface. For example, using 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 method you will be able to use the SDK without regular installation as COM-server on a client machine.

NOTE: in the context of the PDF-XChange Editor SDK this object has a different GUID which is:

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

and we provide two specific methods to access this library:

  • A. by using the CoCreateInstance. For example, in C#:
AxPDFXEdit.AxPXC_Inst pdfCoreInst = AxPDFXEdit.AxPXC_Inst();

Or

  • B. by retrieving a pointer to the IPXC_Inst interface as an 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);
CComQIPtr<IPXC_Inst> spPDFCoreInst = spUnk;

How to Use

If the PDF-XChange Core API SDK is used, this must be initialized by a call to the IPXC_Inst::Init method and should be finalized by a call to the IPXC_Inst::Finalize method. These methods will have no effect within the PDF-XChange Editor SDK.