Community

How to get the processing field as a picture in ICR/HandWritten text in java Answered

for (int i = 0; i < fields.getCount(); i++) {

                IField field = fields.getElement(i);
                IFieldValue fieldValue = field.getValue();

                if(field.getValue().getType().equals(FieldValueTypeEnum.FVT_Picture)){
                    System.out.println(fieldValue.getAsPicture());

                } else{
                trace(field.getName() + ": "
                        + (field.getValue() != null ? field.getValue().getAsString() : "."));
                IFieldValue fieldValue = field.getValue();
                }
}

The above code snippet gave the field value. But i want to save the field value that is an image type. I need to save the picture and place it to a different location. How can i do this in java using flexi capture engine 11

0

Comments

2 comments

  • Avatar
    IvanPopov

    In ABBYY FlexiCapture Engine API, Field objects provide the IField::Blocks property that stores the collection of blocks which correspond to the given field. Depending on the document definition, several blocks may correspond to a single field.

    Block objects have the IBlock::Region property that provides access to the block region - an area of the page that the block occupies or, in other words, its location. Once you have the necessary Region objects (one or several), you can use them to save the corresponding parts of the page image to image files.

    To save a part of a page image, you should first obtain the corresponding ImageDocument object (the IPage::Image property), and then one of its image plane Image objects - either color or black-and-white (properties IImageDocument::ColorImage and IImageDocument::BlackWhiteImage).

    Image objects provide the IImage::WriteToFile() method. By default, this method saves the whole image of the page; to save a part of the page, create an ImageModification object, assign the Region object obtained earlier as the value of the IImageModification::ClipRegion property, and pass the resulting ImageModification object to the WriteToFile() method as one of its parameters.

    If you follow these steps, you should be able to achieve the desired results. Please refer to the Help file articles API Reference→Objects→Document Structure→Field and API Reference→Objects→Image-Related Objects→Image for additional information.

    1
    Comment actions Permalink
  • Avatar
    Shaown

    Thanks it works

    0
    Comment actions Permalink

Please sign in to leave a comment.