We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Calling specific Element in OMR

Hello,

How can I call a specific element from the processed image? For example, in the template, there is an element called element1. How can I assign a textbox to be the result of an element?

ex; textbox1.text = element1

Hi,

Thank you for your inquiry.

OMR Engine returns the page data in the form of Hashtable. Sample code snippet is given below for your reference. You can get the key name (element1) and its value from Hashtable and then assign value to whatever control you want.


// image loading from url
OmrImage image = OmrImage.Load("");
// continue working with template and image as usual
OmrEngine engine = new OmrEngine(template);
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
// Get all page data into an instance of Hashtable
Hashtable[] pages = result.PageData;
// Loop over all the pages
foreach (Hashtable page in pages)
{
// Display key and value
foreach (string key in page.Keys)
{
Console.WriteLine("[KEY] " + key + " => " + "[VALUE] " + page[key]);
}
}

Hey, thanks for replying.

I think we still couldn’t be satisfied. So our next question is: because hashtables don’t maintain the order of entry, can we use a keyedlist instead? If yes, kindly provide an example. Please forgive our poor programming skills.

Thanks again

Hello, we have found our answer. I’ll post here incase somebody else needs it.


To get the value of a specific element:

value.text = page(“element name”)

Hi

Thanks for the acknowledgement. We are glad to hear that your problem is resolved. Please continue using Aspose APIs and in the event of any further query, please feel free to contact.