Saving a printable form and recognition pattern

Contents
[ ]

After the template has been successfully generated, you can save it to disk in the preferred format. The saved results consist of several files:

  • Printable form pages as PNG images. Their dimensions match the provided paper size and orientation.
    Each page is always saved as a separate file. If multiple pages are generated, the suffix “Page{NUMBER}” will be added to each file; for example, “OMR-FormPage1.png”.
  • A recognition pattern used by Aspose.OMR for C++ recognition engine, in a special .OMR format. This file is required for recognizing filled forms, make sure you do not accidentally delete it!

To save a form, call Save method of of the GenerationResult object returned by GenerateTemplate method. The method takes the following arguments:

  • Target directory name, either absolute or relative to your application’s working directory. Provide an empty string to save files into the working directory of the application.
  • File name (without extension) for printable form pages and the recognition pattern.

Printable pages are saved as PNG images.

Example

System::SharedPtr<Api::OmrEngine> engine = System::MakeObject<Api::OmrEngine>();
System::SharedPtr<Generation::GenerationResult> result = engine->GenerateTemplate(u"source.txt");
result.Save("", "OMR-Form");

This code generates the following files under forms sub-directory of the application’s working directory:

File Description
OMR-Form.png An image of a machine-readable form that can be printed and distributed to respondents.
OMR-Form.omr Recognition pattern file, that is used to map optical marks to bubbles for highly accurate recognition.