Community

CORRECT ORIENTATION FOR ALL PAGES

Hello, I will make a contribution to the community, I leave you this script in which you can correct the position of the sheets, this so that Abbyy can correctly recognize your Document Definition, for this to work it is necessary to create a stage before Recognition.

foreach(IDocument doc in Batch.Documents) {
    IPages pages = doc.Pages;
    foreach(IPage page in pages) {
        IPictureObject picture = page.Picture;
        int orientation = picture.DetectPageOrientation("Spanish");
        FCTools.ShowMessage("angulo de la imagen : " + orientation.ToString());
        if(orientation != 0) {
            IEditablePictureObject editablePicture = picture.CreateEditableCopy();
            switch(orientation) {
                case 90:
                    editablePicture.Rotate(270);
                    break;
                case 180:
                    editablePicture.Rotate(180);
                    break;
                case 270:
                    editablePicture.Rotate(90);
                    break;
            }
            page.ReplaceImage(editablePicture);
        }
    }
}

It should be noted that you can also add certain custom image configurations through code or customize them by calling some properties, or also by calling a specific Image Enhancement Profile for each specific image or document.

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

  • Avatar
    Anzhelika Fedko

    Alexander Flores, thanks for sharing the script! 
    I'm sure other users will find it useful.

    0

Please sign in to leave a comment.