@Shonn
As per our assumption, your project structure is:
-
- Student: John Smith
- Test: Biology
- Page 1: Personal info\Barcode
- Page 2: Questions
- Page 3: …
-
- Student: William Davis
- Test: Biology
- Page 1: Personal info\Barcode
- Page 2: Questions
- Page 3: …
If our assumptions are incorrect - please provide detailed descriptions for your project.
“Personal” approach:
- John Smith.pdf
- John Smith.omr
- William Davis.pdf
- William Davis.omr
- …
Please use code below as an example:
foreach (var student in students)
{
var config = new TemplateConfig()
{
Children = new List<BaseConfig>()
{
new PageConfig()
{
Name = $"first page of {student}",
Children = new List<BaseConfig>()
{
new ContainerConfig()
{
ColumnsCount = 2,
Children = new List<BaseConfig>()
{
new BlockConfig()
{
Column = 1,
Children = new List<BaseConfig>()
{
new ContentConfig()
{
Name = $"STUDENT_ID={student}"
},
new BarcodeConfig()
{
Value = student,
Name = "STUDENT_ID",
DrawCodetext = true,
}
}
}
}
}
}
},
new PageConfig()
{
Name = $"second page of {student}",
Children = new List<BaseConfig>()
{
new ContainerConfig()
{
ColumnsCount = 2,
Children = new List<BaseConfig>()
{
new BlockConfig()
{
Column = 1,
Children = new List<BaseConfig>()
{
new ContentConfig()
{
Name = $"Question 1"
},
}
}
}
}
}
}
}
};
var result = engine.GenerateTemplate(config, new GlobalPageSettings());
result.SaveAsPdf(@"C:\Users\User\Desktop\Students\", $"template_{student}");
}
“In bulk” approach:
- students.pdf
- students.omr
use the code below as an example:
var engine = new OmrEngine();
IEnumerable<string> students = GetStudentsId();
var config = new TemplateConfig()
{
Children = new List<BaseConfig>(students.Count())
};
foreach (var student in students)
{
var firstStudentPage = new PageConfig()
{
Name = $"first page of {student}",
Children = new List<BaseConfig>()
{
new ContainerConfig()
{
ColumnsCount = 2,
Children = new List<BaseConfig>()
{
new BlockConfig()
{
Column = 1,
Children = new List<BaseConfig>()
{
new ContentConfig()
{
Name = $"STUDENT_ID={student}"
},
new BarcodeConfig()
{
Value = student,
Name = "STUDENT_ID",
DrawCodetext = true,
}
}
}
}
}
}
};
var secondStudentPage = new PageConfig()
{
Name = $"second page of {student}",
Children = new List<BaseConfig>()
{
new ContainerConfig()
{
ColumnsCount = 2,
Children = new List<BaseConfig>()
{
new BlockConfig()
{
Column = 1,
Children = new List<BaseConfig>()
{
new ContentConfig()
{
Name = $"Question 1"
},
}
}
}
}
}
};
config.Children.Add(firstStudentPage);
config.Children.Add(secondStudentPage);
}
var result = engine.GenerateTemplate(config, new GlobalPageSettings());
result.SaveAsPdf(@"C:\Users\User\Desktop\Students\", $"template_all");
In this case, you will indeed receive one .pdf and one .omr file. But it will come with handicap - file size overhead.
The size of .pdf and .omr will be multiplied according to student amount.
1 student .omr file = 2kb. 100 students .omr file = 200kb. 1000 students .omr file = 2mb.
Recognition would have to be in bulk too.