how to set page size to A3 when Building forms programmatically
We need to check the details for this requirement. Can you please share your sample OMR template for our reference?
in fact, I have just discovered this product which interests me enormously. but by exploring the sample code provided, I found that the questionnaires that I want to automate are designed on A3 paper and that the product does not allow me to define the page in A3 format. suggest me any sample OMR template in A3 format if possible. However, here is the sample code I used.
using Aspose.OMR;
using Aspose.OMR.Api;
using Aspose.OMR.Generation;
using Aspose.OMR.Generation.Config;
using Aspose.OMR.Generation.Config.Elements;
using Aspose.OMR.Generation.Config.Elements.Parents;
using Aspose.OMR.Generation.Config.Enums;
using System;
using System.Collections.Generic;
using System.IO;
namespace FormBuilder
{
internal class Program
{
public static string AppPath;
static void Main(string[] args)
{
AppPath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
// Mock data
Dictionary<Guid, string> students = new Dictionary<Guid, string>();
students.Add(Guid.NewGuid(), "John Doe");
students.Add(Guid.NewGuid(), "Mary Sue");
students.Add(Guid.NewGuid(), "Edgar Allan Poe");
// Set license
var license = new License();
license.SetLicense(Path.Combine(AppPath, "Aspose.OMR.NET.lic"));
// Initialize Aspose.OMR engine
OmrEngine omrEngine = new OmrEngine();
GlobalPageSettings globalPageSettings = new GlobalPageSettings() {
PaperSize = PaperSize.A4,
};
// Generate forms
foreach(var student in students)
{
// Build form
TemplateConfig templateConfig = new TemplateConfig() {
Children=new List<BaseConfig>() {
new PageConfig() {
Children = new List<BaseConfig>() {
new ContainerConfig() {
Name = $"Personalized answer sheet for {student.Value}",
ColumnsCount = 2,
Children = new List<BaseConfig>() {
new BlockConfig() {
Column = 1,
Children = new List<BaseConfig>() {
new ParagraphConfig() {
Children = new List<BaseConfig>() {
new ContentConfig() {
Name = "Final Exam",
FontSize = 18,
FontStyle = FontStyle.Bold
},
new ContentConfig() {
Name = "Answer Sheet",
FontSize = 18,
FontStyle = FontStyle.Bold
},
}
}
}
},
new BlockConfig() {
Column = 2,
Children = new List<BaseConfig>() {
new BarcodeConfig() {
Name = "Student ID",
Value = student.Key.ToString(),
Height = 200
}
}
}
}
},
new EmptyLineConfig(),
new InputGroup() {
InputBorder = BorderType.Square,
Children = new List<BaseConfig>() {
new ContentConfig() {
Name = "Student name",
FontStyle = FontStyle.Bold,
FontSize = 11
},
new ContentConfig() {
Name = student.Value,
Alignment = AlignmentEnum.Center
}
}
},
new EmptyLineConfig(),
new AnswerSheetConfig() {
Name = "Answers",
ColumnsCount = 4,
ElementsCount = 100,
AnswersCount = 5,
BubbleSize = BubbleSize.Small,
VerticalMargin = 10
}
}
}
}
};
// Save form
GenerationResult generationResult = omrEngine.GenerateTemplate(templateConfig, globalPageSettings);
generationResult.SaveAsPdf("forms", student.Value.Replace(' ', '_'));
}
}
}
}
I was thinking of modifying just this block of code by replacing A4 by A3 but this would generate an error.
GlobalPageSettings globalPageSettings = new GlobalPageSettings() {
**PaperSize = PaperSize.A4,**
};
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): OMRNET-836
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thanks for your support