Question
Is there a way to process only the first page of a document and skip the others?
Answer
There are two methods to do the above.
- Using Annex pages
In the Document Definition properties, enable annex pages.
Please change the numbers of annex pages and Document Definition sections according to your needs.
The pages that are not able to be recognized with the Document Definition sections will be marked as unknown pages and will become annex pages.
This method requires recognition, so even if you set unneeded pages as annexes, the number of remaining pages in the license will be reduced.
-
Creating a custom script stage
Another way is to create a custom (script) processing stage before the recognition stage.
You can automatically delete unneeded pages from the batch, leaving only the first page of the document. The sample code snippet is as below:while(Batch.Documents.Count>1)
The added custom script stage should look like on the screenshot below:
{
FCTools.ShowMessage("Overall:" + Batch.Documents.Count.ToString());
Batch.DeleteDocument(Documents[(Documents.Count)-1]);
FCTools.ShowMessage("Currently Deleting" + Documents.Count.ToString());
}
This method will leave only the first page of the first imported document if there are multiple files to import in one batch.
Additional information
About Document Definitions with Annex pages:
https://help.abbyy.com/en-us/flexicapture/12/distributed_administrator/doc_annexes
For more information on creating script processing stages:
https://help.abbyy.com/en-us/flexicapture/12/distributed_administrator/workflow_project_settings
https://help.abbyy.com/en-us/flexicapture/12/distributed_administrator/workflow_stages
https://help.abbyy.com/en-us/flexicapture/12/distributed_administrator/scripts_handling
https://help.abbyy.com/en-us/flexicapture/12/distributed_administrator/ibatch
Comments
4 comments
Javier Sucunza
Hi Mariia, Just 2 things:
It is just what I want but I'm working in a Invoices project and FCI projects don't have it, I don't know why. on the other hand I have tried the Script and it does not do that exactly, what it does is: if a batch has more than 1 document, it deletes the rest and only leaves the first. I would like to know if there is an instruction to convert the pages of a document into attachments. in my case I want all annexes but the first.
Thanks and regards,
Javier.
Javier Sucunza
Mariia,
I found the Script: Must be a Stage Script type: "Document Processing" before Recognize Stage.
if(Document.Pages.Count > 1)
{
for (int pageIndex = 1; pageIndex < Document.Pages.Count; pageIndex++)
{
Document.Pages[pageIndex].MarkAsAnnex();
}
}
after this you have to add:
Event Handlers > Before Matching script:
Matching.MaxPagesToMatch = 1;
Ranjit Nayak
I need to exclude pages for a specific vendor, how do i do this?
Mariia Indosova
Hi Ranjit,
I have created a support ticket for your question and will be contacting you there soon. Thank you!
Please sign in to leave a comment.