Ikram ul Haq June 15, 2015one Comment

Improved process for dynamic creation of OMR template with Aspose.OCR for Java 2.5.0

Improved process for dynamic creation of OMR template with Aspose.OCR for Java 2.5.0

June 15, 2015
Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.OCR for Java logo We’re pleased to announce the release of Aspose.OCR for Java 2.5.0. In this version, you will find Improved OCR engine performance, improved Barcode element recognition process and how to create OMR templates dynamically & efficiently. Please review the release notes of Aspose.OCR for Java 2.5.0 for a complete list of enhancements. If you are planning to upgrade the API from previous revision, go ahead as there is no change in the API. For those who are planning to upgrade the API from version Aspose.OCR 2.0.0, may visit our documentation article Migrating from Earlier Versions of Aspose.OCR.

How to dynamically create OMR Template

In addition to OMR Template Editor application used to create the templates, developers can also dynamically create templates using the code. As an example, let us create an OMR template with a ChoiceBox element having four values.

  • Create an empty template using the OmrTemplate class:

    OmrTemplate template = new OmrTemplate();

  • Access the default page by specifying its Height & Width:

    OmrPage page = template.getPages().getItem(0);

    Note: By default the template has one page in page collection. Every page has its dimensions. You can set dimensions through Width and Height properties of the OmrPage class.

  • Set the position & diementions of the element:

    java.awt.geom.Point2D.Float choiceBoxPosition = new java.awt.geom.Point2D.Float(20, 5);
    // 20 mm to the right, 5 mm from the top

    Dimension choiceBoxSize = new Dimension(12, 24);

  • Create ChoiceBox element:

    ChoiceBoxElement choiceBox = new ChoiceBoxElement(“AnotherElement”, choiceBoxPosition, choiceBoxSize);

  • Set the element orientation:


    Note: The values of the choiceBox element can be oriented as horizontally or vertically.

  • Set the four values of the choiceBox:

    choiceBox.getCells().add(new OmrCell(“A”));
    choiceBox.getCells().add(new OmrCell(“B”));
    choiceBox.getCells().add(new OmrCell(“C”));
    choiceBox.getCells().add(new OmrCell(“D”));

    Note: The values can be set as (1,2,3,4) or (A,B,C,D).

  • Save the Template:


Sample template will look like as below, which is a perfect working template: OMR Template Using Code

Enhancements & Fixes

This release has addressed a few critical issues and has incorporated some enhancements. The details are given below:

Aspose.OCR for Java Resources

The resources, you may need to accomplish your tasks:

As always, we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.OCR forum for a chat.

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.OCR Product Family

Related Articles