public static void Run() { // ExStart:1 // input and output preparation string testFolderPath = RunExamples.GetGenerationSourceDir(); string outputPath = RunExamples.GetResultDir(); string[] images = { Path.Combine(testFolderPath, "Aspose.jpg") }; // initialize engine OmrEngine engine = new OmrEngine(); GenerationResult res = engine.GenerateTemplate(Path.Combine(testFolderPath, "AsposeTestWithImage.txt"), images); // check in case of errors if (res.ErrorCode != 0) { Console.WriteLine("ERROR CODE: " + res.ErrorCode); } // save generation result: image and .omr template res.Save(outputPath, "AsposeTestWithImage"); // ExEnd:1 Console.WriteLine("GenerateTemplateWithImages executed successfully.\n\r"); }
public static void Run() { // ExStart:1 // input and output preparation string testFolderPath = RunExamples.GetGenerationSourceDir(); string outputPath = RunExamples.GetResultDir(); string[] GenerationMarkups = new string[] { "Sheet.txt", "Grid.txt", "AsposeTest.txt" }; // initialize engine OmrEngine engine = new OmrEngine(); for (int i = 0; i < GenerationMarkups.Length; i++) { // call template generation providing path to the txt file with markup GenerationResult res = engine.GenerateTemplate(Path.Combine(testFolderPath, GenerationMarkups[i])); // check in case of errors if (res.ErrorCode != 0) { Console.WriteLine("ERROR CODE: " + res.ErrorCode); } // save generation result: image and .omr template res.Save(outputPath, Path.GetFileNameWithoutExtension(GenerationMarkups[i])); } // ExEnd:1 Console.WriteLine("GenerateTemplates executed successfully.\n\r"); }
static void GenerateFormTemplateAndImage() { //fully qualified path to the form markup file var formMarkupFilePath = AppDomain.CurrentDomain.BaseDirectory + "QuestionnaireMarkup.txt"; //initialize an instance of the Aspose OMR engine var omrEngine = new OmrEngine(); //use the Aspose OMR engine to generate the template and image from the markup file var result = omrEngine.GenerateTemplate(formMarkupFilePath); if (result.ErrorCode != 0) { Console.WriteLine($"ERROR: {result.ErrorCode} - {result.ErrorMessage}"); } else { //save the files as OmrOutput.omr for the template, and OmrOutput.png for the form image result.Save("", "OmrOutput"); } }