PDF-X OCR SDK is a New product from us and intended to compliment our existing PDF and Imaging Tools to provide the Developer with an expanding set of professional tools for Optical Character Recognition tasks
I'm using Visual Studio Community 2015 to build a 64-bit app that will OCR some PDF's through a scanning pipeline. I'm getting an unhandled exception during the OCR_LoadW call, and I can't seem to get by it. Short version of the code is:
int main(int argc, char** argv) {
if (argc < 3) {
cout << "Both an input and output file must be specified on the command line" << endl;
return 0;
}
DWORD maxLevel;
PXODocument doc; ZeroMemory(&doc, sizeof(PXODocument));
HRESULT r;
r = OCR_Init(&doc, oldLicense, oldLicenseDev);
if (IS_DS_FAILED(r)) {
cout << "Failed to initialize OCR engine" << endl;
return -1;
}
r = OCR_SetCallback(&doc, &ocrCallback, (LPARAM)&maxLevel); // Should be doc, not &doc
if (IS_DS_FAILED(r)) {
cout << "Failed to define callback procedure" << endl;
return -1;
}
string src(argv[1]);
wstring wsrc(src.begin(), src.end());
r = OCR_LoadW(doc, (LPWSTR)(wsrc.c_str())); // <- Exception occurs here
if (IS_DS_FAILED(r)) {
cout << "Unable to load " << argv[1] << endl;
return -1;
}
The compiler doesn't differentiate between a PXODocument and *PXODocument because PXODocument is a void*. You have to turn the compiler warnings up a couple of clicks to get a warning about the mis-use of the pointer.