PDF Core Layer
(Created page with "Category:Editor {{#customTitle:PDFRenderLib}}") |
|||
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Editor]] | [[Category:Editor]] | ||
− | {{#customTitle: | + | {{#customTitle:PDF Core Layer}} |
+ | {{#treeOrder:after:PXV:PXV}} | ||
+ | |||
+ | == Introduction == | ||
+ | '''PDF Core Library''' is one layer of the ''PDF-XChange Editor SDK'' and ''PDF-XChange Core API SDK''. Interfaces of this layer provide access to high level objects of a PDF file, such as [[PXV:IPXC_Document|document]], [[PXV:IPXC_Page|pages]], [[PXV:IPXC_Annotation|annotations]], [[PXV:IPXC_FormField|form fields]], etc. | ||
+ | |||
+ | The creation of new documents as well as modification to existing documents is supported. Further a means to render PDF pages to [[PXV:IPXC_Page_DrawToDevice|devices]] or to [[PXV:IPXC_Page_DrawToIXCPage|image]] to display content to a users screen is available. | ||
+ | |||
+ | == PDF-XChange Core API SDK == | ||
+ | |||
+ | If the ''PDF-XChange Core API SDK'' is used, it '''must''' be initialized calling [[PXV:IPXC_Inst_Init|IPXC_Inst::Init]] method and should be finalized by calling the [[PXV:IPXC_Inst_Finalize|IPXC_Inst::Finalize]] method. | ||
+ | This method will have no effect within the ''PDF-XChange Editor SDK''. | ||
+ | |||
+ | The ''PDF-XChange Core API SDK'' consists of one DLL and can be used without registration as a COM server. To use the ''PDF-XChange Core API SDK'' a developer must create an instance of the '''[[PXV:IPXC_Inst|IPXC_Inst]]''' object. There are several ways to do this. | ||
+ | * If the ''PDF-XChange Core API SDK'' is used as a registered COM server, an '''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 using the ''PDF-XChange Core API SDK'' without registration as a COM server, the function '''PXC_GetInstance''', exported by the SDK's DLL should be called to get the '''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> | ||
+ | |||
+ | When '''IPXC_Inst''' is received, its method [[PXV:IPXC_Inst_Init|Init]] '''must''' be called to initialize the SDK and pass optionally a valid serial key. Use without first making this call with a valid serial key will result in the SDK functioning in 'Evaluation' mode. | ||
+ | |||
+ | == PDF-XChange Editor SDK == | ||
+ | |||
+ | In the ''PDF-XChange Editor SDK'' the '''IPXC_Inst''' is initialized by the SDK itself and the methods '''Init''' and '''Finalize''' should not be used. '''IPXC_Inst''' object can be retrieved from the '''PDF-XChange Editor SDK's''' main object in the following way: | ||
+ | <pre class="brush:cpp"> | ||
+ | HRESULT fGetInst(IPXV_Inst* pVInst, CComPtr<IPXC_Inst>& inst) | ||
+ | { | ||
+ | inst = nullptr; | ||
+ | if (pVInst == nullptr) | ||
+ | return E_INVALIDARG; | ||
+ | CComPtr<IUnknown> pExt; | ||
+ | HRESULT hr = pVInst->GetExtension(L"PXC", &pExt); | ||
+ | if (FAILED(hr)) | ||
+ | return hr; | ||
+ | hr = pExt->QueryInterface<IPXC_Inst>(&inst); | ||
+ | return hr; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | == References == | ||
+ | * [[PXV:PXC_Enumerations|Enumerations]] | ||
+ | * [[PXV:PXC_Interfaces|Interfaces]] | ||
+ | * [[PXV:PXC_Structures|Structures]] |
Latest revision as of 09:39, 16 September 2015
Introduction
PDF Core Library is one layer of the PDF-XChange Editor SDK and PDF-XChange Core API SDK. Interfaces of this layer provide access to high level objects of a PDF file, such as document, pages, annotations, form fields, etc.
The creation of new documents as well as modification to existing documents is supported. Further a means to render PDF pages to devices or to image to display content to a users screen is available.
PDF-XChange Core API SDK
If the PDF-XChange Core API SDK is used, it must be initialized calling IPXC_Inst::Init method and should be finalized by calling the IPXC_Inst::Finalize method. This method will have no effect within the PDF-XChange Editor SDK.
The PDF-XChange Core API SDK consists of one DLL and can be used without registration as a COM server. To use the PDF-XChange Core API SDK a developer must create an instance of the IPXC_Inst object. There are several ways to do this.
- If the PDF-XChange Core API SDK is used as a registered COM server, an 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 using the PDF-XChange Core API SDK without registration as a COM server, the function PXC_GetInstance, exported by the SDK's DLL should be called to get the 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; }
When IPXC_Inst is received, its method Init must be called to initialize the SDK and pass optionally a valid serial key. Use without first making this call with a valid serial key will result in the SDK functioning in 'Evaluation' mode.
PDF-XChange Editor SDK
In the PDF-XChange Editor SDK the IPXC_Inst is initialized by the SDK itself and the methods Init and Finalize should not be used. IPXC_Inst object can be retrieved from the PDF-XChange Editor SDK's main object in the following way:
HRESULT fGetInst(IPXV_Inst* pVInst, CComPtr<IPXC_Inst>& inst) { inst = nullptr; if (pVInst == nullptr) return E_INVALIDARG; CComPtr<IUnknown> pExt; HRESULT hr = pVInst->GetExtension(L"PXC", &pExt); if (FAILED(hr)) return hr; hr = pExt->QueryInterface<IPXC_Inst>(&inst); return hr; }