PXCp_ET_GetPageContentAsTextW fails in C#
Posted: Fri Jan 12, 2018 2:18 pm
Hi
Somehow I get the error: "Invalid function call sequence" when trying to get text. I know positively that the document contains searchable text.
What am I doing wrong?
Here is my code:
int res;
int pdf;
int numPagesInPdf = 0;
res = XCPro40_Defs.PXCp_Init(out pdf, XCPro40_Defs.g_SDKRegKey, XCPro40_Defs.g_DevCode);
res = XCPro40_Defs.PXCp_ReadDocumentW(pdf, fileFullPath, 0);
res = XCPro40_Defs.PXCp_GetPagesCount(pdf, out numPagesInPdf);
XCPro40_Defs.PXP_TETextComposeOptions txtComposeOptions;
XCPro40_Defs.PXCp_ET_GetCurrentComposeParams(pdf, out txtComposeOptions);
IntPtr pBuffer = IntPtr.Zero;
int bufferLen = 0;
for (int i=0; i<numPagesInPdf; i++)
{
res = XCPro40_Defs.PXCp_ET_GetPageContentAsTextW(pdf, i, ref txtComposeOptions, out pBuffer, ref bufferLen);
if (res < 0)
{
PXCp_Error.ShowDSErrorString(this, res);
}
}
res = XCPro40_Defs.PXCp_Delete(pdf);
Somehow I get the error: "Invalid function call sequence" when trying to get text. I know positively that the document contains searchable text.
What am I doing wrong?
Here is my code:
int res;
int pdf;
int numPagesInPdf = 0;
res = XCPro40_Defs.PXCp_Init(out pdf, XCPro40_Defs.g_SDKRegKey, XCPro40_Defs.g_DevCode);
res = XCPro40_Defs.PXCp_ReadDocumentW(pdf, fileFullPath, 0);
res = XCPro40_Defs.PXCp_GetPagesCount(pdf, out numPagesInPdf);
XCPro40_Defs.PXP_TETextComposeOptions txtComposeOptions;
XCPro40_Defs.PXCp_ET_GetCurrentComposeParams(pdf, out txtComposeOptions);
IntPtr pBuffer = IntPtr.Zero;
int bufferLen = 0;
for (int i=0; i<numPagesInPdf; i++)
{
res = XCPro40_Defs.PXCp_ET_GetPageContentAsTextW(pdf, i, ref txtComposeOptions, out pBuffer, ref bufferLen);
if (res < 0)
{
PXCp_Error.ShowDSErrorString(this, res);
}
}
res = XCPro40_Defs.PXCp_Delete(pdf);