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

asked 24 Jul '16, 13:55

Shaown's gravatar image

Shaown
175

edited 25 Jul '16, 06:49


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.

link

answered 12 Aug '16, 15:12

IvanPopov's gravatar image

IvanPopov ♦♦
364

Thanks it works

(13 Aug '16, 08:09) Shaown
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×47
×30
×5
×4

Asked: 24 Jul '16, 13:55

Seen: 1,121 times

Last updated: 15 Aug '16, 11:35

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal