Perform Action on PDDoc
Hi all,
comming from thread Re: Acrobat not releasing files, AV_Layer, AVDocDoSave(), AVDocClose() I'd like to clarify how I can work on the PDDoc API.
My aim is to perform an OCR on a given document. To do so I've tried for example:
ASAtom pathType = ASAtomFromString(
"Cstring");
ASFileSys fileSys = ASGetDefaultFileSysForPath(pathType,
"C:/_TRANSFER/a4.pdf");
ASPathName pathLaunchFile = ASFileSysCreatePathName(fileSys, pathType,
"C:/_TRANSFER/a4.pdf", NULL);
// AVDoc avDoc = AVDocOpenFromFile(pathLaunchFile, fileSys, NULL);
// PDDoc pdDoc = AVDocGetPDDoc(avDoc);
PDDoc pdDoc = PDDocOpen(pathLaunchFile, fileSys, false, false);
PDAction myAct1 = PDActionNew(pdDoc, ASAtomFromString("PaperCapture"));
CosObj onObj = PDActionGetCosObj(myAct1);
CosDoc cosDoc = CosObjGetDoc(onObj);
PDDoc pdDocNew = PDDocFromCosDoc(cosDoc);
PDSaveFlags pdsaveflags = PDSaveFlags();
ASProgressMonitor asProgressMonitor = ASProgressMonitor();
PDDocSave(pdDocNew, pdsaveflags, pathLaunchFile, fileSys, asProgressMonitor, false);
PDDocClose(pdDoc);
PDDocRelease(pdDoc);
But this seems to be not working at all since the file is obviously updated (new timestamp) - even with a larger filesize, but not OCR is performed (tested by search for Words, which are available after a manual OCR).
Any suggestions? 😃
Cheers,
S.
