PDF Core Library

From PDF XChange PDF SDK
Jump to: navigation, search
Line 8: Line 8:
 
It allows creation of new document as well as modification of existing documents. It also contains method to render PDF pages to [[PXV:IPXC_Page_DrawToDevice|devices]] or to [[PXV:IPXC_Page_DrawToIXCPage|image]].
 
It allows creation of new document as well as modification of existing documents. It also contains method to render PDF pages to [[PXV:IPXC_Page_DrawToDevice|devices]] or to [[PXV:IPXC_Page_DrawToIXCPage|image]].
  
 +
== PDF-XChange Core SDK ==
 +
 +
If ''PDF-XChange Core PDF SDK'' is used, it '''must''' be initialized by call [[PXV:IPXC_Inst_Init|IPXC_Inst::Init]] method and should be finalized by call [[PXV:IPXC_Inst_Finalize|IPXC_Inst::Finalize]] method.
 +
This method will have no effect in ''PDF-XChange Editor SDK''.
 +
 +
''PDF-XChange Core SDK'' consists of one DLL and can be used without registration it as COM server. To start using the ''PDF-XChange Core SDK'' developer must create an instance of '''[[PXV:IPXC_Inst|IPXC_Inst]]''' object. There are several ways to do that.
 +
* If ''PDF-XChange Core SDK'' is used as registered COM server, '''IPXC_Inst''' object should be created using '''CoCreateInstance''' call:
 +
<pre class="brush:cpp">
 +
HRESULT fGetInst(CComPtr<IPXC_Inst>& inst)
 +
{
 +
  inst = nullptr;
 +
  HRESULT hr = CoCreateInstance(__uuidof(PXC_Inst), nullptr, CLSCTX_INPROC_SERVER, __uuidof(IPXC_Inst), (void**)&inst);
 +
  return hr;
 +
}
 +
</pre>
 +
 +
* If ''PDF-XChange Core SDK'' without registration COM server, function '''PXC_GetInstance''', exported by SDK's DLL, should be called to get '''IPXC_Inst''' object:
 +
<pre class="brush:cpp">
 +
typedef HRESULT (WINAPI *fnPXC_GetInstance)(IPXC_Inst** ppInst);
 +
 +
HRESULT fGetInst(CComPtr<IPXC_Inst>& inst)
 +
{
 +
  inst = nullptr;
 +
  HMODULE hSDKInst = LoadLibrary(_T("PDFXCoreAPI.x64.dll"));
 +
  if (hSDKInst == nullptr)
 +
    return E_FAIL;
 +
  fnPXC_GetInstance pfn = (fnPXC_GetInstance)GetProcAddress(hSDKInst, "PXC_GetInstance");
 +
  if (pfn == nullptr)
 +
    return E_FAIL;
 +
  HRESULT hr = pfn(&inst);
 +
  return hr;
 +
}
 +
</pre>
  
 
* [[PXV:PXC_Enumerations|Enumerations]]
 
* [[PXV:PXC_Enumerations|Enumerations]]
 
* [[PXV:PXC_Interfaces|Interfaces]]
 
* [[PXV:PXC_Interfaces|Interfaces]]
 
* [[PXV:PXC_Structures|Structures]]
 
* [[PXV:PXC_Structures|Structures]]

Revision as of 13:19, 27 May 2015


Introduction

PDF Core Library is one of the layer of PDF-XChange Editor SDK and PDF-XChange Core PDF SDK. Interfaces of this layer provides an access to high level objects of PDF file, such as document, pages, annotations, form fields, etc.

It allows creation of new document as well as modification of existing documents. It also contains method to render PDF pages to devices or to image.

PDF-XChange Core SDK

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

PDF-XChange Core SDK consists of one DLL and can be used without registration it as COM server. To start using the PDF-XChange Core SDK developer must create an instance of IPXC_Inst object. There are several ways to do that.

  • If PDF-XChange Core SDK is used as registered COM server, IPXC_Inst object should be created using CoCreateInstance call:
HRESULT fGetInst(CComPtr<IPXC_Inst>& inst)
{
  inst = nullptr;
  HRESULT hr = CoCreateInstance(__uuidof(PXC_Inst), nullptr, CLSCTX_INPROC_SERVER, __uuidof(IPXC_Inst), (void**)&inst);
  return hr;
}
  • If PDF-XChange Core SDK without registration COM server, function PXC_GetInstance, exported by SDK's DLL, should be called to get IPXC_Inst object:
typedef HRESULT (WINAPI *fnPXC_GetInstance)(IPXC_Inst** ppInst);

HRESULT fGetInst(CComPtr<IPXC_Inst>& inst)
{
  inst = nullptr;
  HMODULE hSDKInst = LoadLibrary(_T("PDFXCoreAPI.x64.dll"));
  if (hSDKInst == nullptr)
    return E_FAIL;
  fnPXC_GetInstance pfn = (fnPXC_GetInstance)GetProcAddress(hSDKInst, "PXC_GetInstance");
  if (pfn == nullptr)
    return E_FAIL;
  HRESULT hr = pfn(&inst);
  return hr;
}