Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.OMR allows you to customize questionnaires, answer sheets, and other forms by adding images (such as your company logo) to them. In addition to describing the element in the source code, the full path to each image file must be directly passed to the form generator.
Image paths can be provided with:
Generate
] method.ImagesPaths
property of GlobalPageSettings
object. Full paths to images are provided as an array of strings.Aspose.OMR.Api.ImageCollection
object - a collection of key-value pairs where the key contains the image file name and the value contains the binary content (System.IO.MemoryStream
) of the image file.Template source code:
?image=aspose-logo.png
align=center
?text=Customer Satisfaction Survey
align=center
font_size=16
font_style=bold
?image=vignette.png
align=center
Generate and save the printable form, providing images by file paths:
string workingDirectory = System.IO.Directory.GetCurrentDirectory();
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
PaperSize = Aspose.OMR.Generation.PaperSize.Tabloid,
BubbleColor= Aspose.OMR.Generation.Color.Red,
ImagesPaths = new string[] {
System.IO.Path.Combine(workingDirectory, "aspose-logo.png"),
@"C:\Users\Public\Pictures\vignette.png"
}
};
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.Generate("source.txt", globalPageSettings);
generationResult.Save("", "OMR-Form");
Generate and save the printable form, loading images from memory:
string sourceCode = File.ReadAllText(@"source.txt");
var buffer = Encoding.UTF8.GetBytes(sourceCode);
ImageCollection images = new ImageCollection();
images.Add("aspose-logo.png", new MemoryStream(File.ReadAllBytes(System.IO.Path.Combine(workingDirectory, "aspose-logo.png"))));
images.Add("vignette.png", new MemoryStream(File.ReadAllBytes(@"C:\Users\Public\Pictures\vignette.png")));
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
using(MemoryStream source = new MemoryStream(buffer))
{
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.Generate(source, images);
generationResult.Save("", "OMR-Form");
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.