Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
After the template has been successfully generated, you can save it to disk in the preferred format.
The saved results consist of several files:
The printable form can be saved in one or more images (one image per page) or in one PDF document. Regardless of the chosen format, the recognition pattern file is always saved to the save folder.
Call Save method of of the GenerationResult object returned by Generate method. The method takes the following arguments:
Printable pages are saved as PNG images. Their dimensions match the provided paper size and orientation.
The method described below is used for saving a form as an image-only (printable) PDF. To convert bubbles ant write-ins to interactive elements that can be filled electronically, use Aspose.OMR.Generation.GenerationResult.SaveAsInteractivePdf() method.
Call SaveAsPdf method of of the GenerationResult object returned by Generate method. The method takes the following arguments:
The method described below is used for saving a form as a PDF document with interactive elements, such as fields and checkboxes, enabling users to fill it electronically on a computer or smartphone. To get a PDF document that can be printed and filled by hand, use Aspose.OMR.Generation.GenerationResult.SaveAsPdf() method.
The following markup elements are supported in interactive PDFs:
Call SaveAsInteractivePdf method of of the GenerationResult object returned by Generate method. The method takes the following arguments:
If you do not have direct access to storage (for example, when building web applications), you can generate the form into memory.
To enable in-memory form generation, convert the object returned by Generate method to MemoryGenerationResult object:
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.Generate("source.txt");
if(generationResult.ErrorCode != 0)
{
Console.WriteLine(generationResult.ErrorMessage);
return generationResult.ErrorCode;
}
Aspose.OMR.Generation.MemoryGenerationResult memoryGenerationResult = new Aspose.OMR.Generation.MemoryGenerationResult(generationResult);
Call GetImages method of the MemoryGenerationResult object. All pages of the OMR form are returned as a collection of MemoryStream objects containing bitmap images of form pages.
IEnumerable<MemoryStream> pages = memoryGenerationResult.GetImages();
foreach(var page in pages)
{
byte[] pageImageBytes = page.ToArray();
}
Call GetPDF method of the MemoryGenerationResult object. All pages of the OMR form are returned as a MemoryStream object containing a PDF document.
MemoryStream form = memoryGenerationResult.GetPDF();
byte[] formBytes = form.ToArray();
Call GetOmr method of the MemoryGenerationResult object. The recognition pattern is returned as a MemoryStream object.
MemoryStream omr = memoryGenerationResult.GetOmr();
byte[] recognitionPattern = omr.ToArray();
GenerationResult object returned by Generate method also contains a collection of all generated printable pages (as System.Drawing.Bitmap objects). You can manually iterate through this list and save the pages in different formats if necessary.
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.Generate("source.txt");
if(generationResult.ErrorCode != 0)
{
Console.WriteLine(generationResult.ErrorMessage);
return generationResult.ErrorCode;
}
int i = 1;
foreach(System.Drawing.Bitmap bitmap in generationResult.MultipageTemplateImages)
{
bitmap.Save($"page-{i++}.bmp");
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.