Community

RECOGNIZE ONLY THE FIRST PAGE OF THE DOCUMENT

If you need to recognize only the frist page of your document, must use this script 

foreach (IDocument doc in Batch.Documents)
    {
            for (int i = 1; i < doc.Pages.Count; ++i)
            {
                IPage page = doc.Pages[i + 1];
                FCTools.ShowMessage(":: Pag " + (i + 1));
                Batch.DeletePage(page);
            }
        
    }
This script has to be before Recognition stage. In order to delete all pages except, the first. You can also make some changes and use Bactch properties or documents properties as this example: 

var etapa = Batch.Properties.Get("stage");

if (etapa == "recepcion")
{
    foreach (IDocument doc in Batch.Documents)
    {
        var filename = doc.Pages[0].ImageSource.ToLower();
        if (filename.Contains("audatex"))
        {
            FCTools.ShowMessage($"Nombre de Audatex: {filename} || Pages in DocDef: {doc.Pages.Count}");
            for (int i = doc.Pages.Count - 1; i > 0; --i)
            {
                FCTools.ShowMessage($":: Pag {i + 1}");
                Batch.DeletePage(doc.Pages[i]);
            }
        }
    }
}

 
 

Was this article helpful?

1 out of 1 found this helpful

Comments

1 comment

  • Avatar
    Dmytro Bezus

    Hi Alexander,

    Thanks so much for sending over your script sample! We appreciate you taking the time to share it with us. The script is well-written and could be a helpful resource in the future.

    0

Please sign in to leave a comment.