<< Click to Display Table of Contents >> Navigation: Functions > PXCV_ReadDocumentW |
PXCV_ReadDocumentW reads documents from specified PDF files.
HRESULT PXCV_ReadDocumentW(
PXVDocument Doc,
LPCWSTR pwFileName,
DWORD Flags
);
Doc
[in] Specifies a document that PXCV_Init created.
pwFileName
[in] Specifies a pointer to a null-terminated UNICODE string that contains the fully qualified path to the file.
Flags
[in] This parameter is reserved for future use and should be set to 0.
Please note that all functions and parameters are case-sensitive.
If the function succeeds then the return value is DS_OK.
If the function fails then the return value is an error code.
If the function return value is equal to PS_ERR_DocEncrypted then PXCV_CheckPassword and PXCV_FinishReadDocument must be used to complete the reading and parsing of the document.
// Generic example on how to read the document
PXVDocument hDocument = NULL;
// Please note - RegCode and DevCode are case sensitive
LPCSTR regcode = "<Your serial/keycode code here>";
LPCSTR devcode = "<Your developers' code here>";
HRESULT res = PXCV_Init(&hDocument, regcode, devcode);
if (IS_DS_FAILED(res))
return res;
hr = PXCV_ReadDocumentW(hDocument, FileName, 0);
if (IS_DS_FAILED(hr))
{
if (hr == PS_ERR_DocEncrypted)
{
while (IS_DS_FAILED(hr))
{
BYTE* Password;
DWORD PassLen;
// Obtain password (i.e. showing some dialog)
// ...
// Check password
hr = PXCV_CheckPassword(hDocument, Password, PassLen);
}
// Finish read document
hr = PXCV_FinishReadDocument(hDocument, 0);
if (IS_DS_FAILED(hr))
{
PXCV_Delete(hDocument);
// In this case document seems to be corrupted
// ...
}
}
else
{
PXCV_Delete(hDocument);
// In this case document seems to be corrupted
// ...
}
}
// In this place the document is completely read.