Question
How to exclude pages from recognition?
Answer
- Advanced workflow is required.
-
Create an automatic script stage before recognition for batch processing. This script should remove the pages, save them as regular files in a temporary directory, save the name of the temp files and their amount:
int from=1; // first page is 0
int to=1;
Random r = new Random();
string fileName = "d://temp"+r.Next(1000000).ToString()+"_";
//let's save the values for restoring
Batch.Properties.Set("from",from);
Batch.Properties.Set("to",count);
Batch.Properties.Set("fileName",fileName);
//save file and remove it from recognition
for(int i=from;i<count&&i<to;i++){
Documents[i].SaveAs(fileName + i.ToString() + ".jpg");
Batch.DeleteDocument(Documents[i]);
} -
Create additional automatic stage after recognition. Here you just need to load saved pages into an already recognized document:
for(int i=Batch.Properties.Get("from"); i<Batch.Properties.Get("to"); i++){
string fn = Batch.Properties.Get("fileName") + i.ToString() + ".jpg";
IEditablePictureObject img = FCTools.LoadImage(fn);
Batch.CreatePageFromImage(img,Documents[0],-1);
} -
You can see that the second page is a part of the document. The counter in the License Manager has been decreased by one.
Comments
3 comments
Nikita Shevchenko
You can use Attachments instead of disk storage. Please use the next code as an example to skip recognition for some particular pages. In the next example, I have sent two images and the second one is skipped.
Perhaps we can skip converting to Base64 and attach an image directly.
Daniel Salazar
Hi, thanks for sharing this example.
Correct me if I am wrong, but this script would only work if the whole document is separated into pages. And there is only one document in the batch?
Is there a way to do this but instead have several documents in one batch? These documents are already assembled.
Best regards
Nikita Shevchenko
There is a better way.
https://support.abbyy.com/hc/en-us/articles/4411168402963-How-to-extract-data-on-a-certain-amount-of-pages-in-FlexiCapture-12
Please sign in to leave a comment.