Page setup
The paper size, orientation, font, and other layout settings are configured through GlobalPageSettings
object. It also allows you to provide paths to images used in the form. GlobalPageSettings
object is passed as an optional parameter to the template generation methods.
Page setup
You can customize the following page layout parameters through GlobalPageSettings
:
Setting | Type | Default value | Description |
---|---|---|---|
PaperSize |
Aspose.OMR.Generation.PaperSize |
A4 (210 x 297 mm) | Physical page dimensions. |
Orientation |
Aspose.OMR.Generation.Orientation |
Portrait (vertical) | Page orientation. |
PageMarginLeft |
int |
210 pixels | The size of the left page margin in pixels. |
PageMarginRight |
int |
210 pixels | The size of the right page margin in pixels. |
FontFamily |
string |
Segoe UI | Font family for all texts, except for those directly overridden in the source code. For example, "Courier New" .The selected font must be installed on the system that generates the printable form! |
FontSize |
int |
12 | Font size for all texts, except for those directly overridden in the source code. |
FontStyle |
Aspose.OMR.Generation.FontStyle |
Regular | Font style for all texts, except for those directly overridden in the source code. |
BubbleSize |
Aspose.OMR.Generation.BubbleSize |
Normal | Size of answer bubbles, except for those directly overridden in the source code. |
BubbleColor |
Aspose.OMR.Generation.Color |
Black | Color of all answer bubbles in the form. |
Overflow |
Aspose.OMR.Generation.OverflowActions.<Algorithm> |
Do not clip and wrap elements | How to render elements that do not fit in the parent container. See details below. |
ReferencePoints.Offset.Top |
int |
1% of the page height | Offset (in pixels) of the reference point markers from the top edge of the page. |
ReferencePoints.Offset.Bottom |
int |
1% of the page height | Offset (in pixels) of the reference point markers from the bottom edge of the page. |
ReferencePoints.Offset.Left |
int |
1% of the page width | Offset (in pixels) of the reference point markers from the left edge of the page. |
ReferencePoints.Offset.Right |
int |
1% of the page width | Offset (in pixels) of the reference point markers from the right edge of the page. |
ReferencePoints.RotationMarkerPosition |
Aspose.OMR.Generation.RotationPointPosition |
Below the top-right square reference point marker | The placement of the rectangular rotation marker that is used to detect the page orientation. See details below. |
WritingSystem |
Aspose.OMR.Generation.WritingSystems.WritingSystem |
Left-to-right (LTR), Western numbering | Localization, which affects text direction (LTR or RTL) and item numbering of generated OMR forms. |
ImagesPaths |
string[] |
n/a | Full path to each image mentioned in the source code. Read more info in this article. |
LongWordHandling |
Aspose.OMR.Generation.LongWordHandling |
Draw word over element’s bounds | How to render very long words that do not fit the parent element’s width and cannot be wrapped.
|
BatchBarcode |
BarcodeConfig |
n/a | Defines the type, position and size of a mandatory barcode element which contains the unique identifier of a personalized form in the batch. The barcode element is required for proper processing of bubbles and to distinguish between individual forms in batches. It cannot be disabled or removed. This element is drawn on top of form elements, except for reference point markers. Choose the position where it does not overlap with any other form element. |
Multiselect |
bool |
true |
When set to false , the OMR API validates whether multiple answers are selected and throws an exception if more than one choice is detected. This mode is particularly useful for processing exam sheets and quizzes, where only a single answer per question is expected.If set to true (default behavior), multiple answers for the same question are processed without errors. This behavior maintains compatibility with Aspose.OMR forms from version 24.1.0 and earlier. This setting can be overridden on individual element level. |
Supported paper sizes
The PaperSize
property controls the paper size of the generated form. All form elements will be re-aligned to best match the selected paper size.
Enumeration | Page dimensions (pixels) | Page dimensions (mm) | Page dimensions (inches) |
---|---|---|---|
A3 |
3508 x 4961 | 297 x 420 | 11.7 x 16.5 |
A4 |
2480 x 3508 | 210 x 297 | 8.3 x 11.7 |
Legal |
2551 x 4205 | 215.9 x 355.6 | 8.5 x 14 |
Letter |
2551 x 3295 | 215.9 x 279.4 | 8.5 x 11 |
p8519 |
2551 x 5702 | 215.9 x 482.6 | 8.5 x 19 |
p8521 |
2551 x 6302 | 215.9 x 533.4 | 8.5 x 21 |
Tabloid |
3295 x 5102 | 279 x 432 | 11 x 17 |
Rotation marker placement
The ReferencePoints.RotationMarkerPosition
property controls the placement of the rectangular rotation marker that is used to detect the page orientation. It is provided one of the following values of Aspose.OMR.Generation.RotationPointPosition
enumerator:
Enumeration | Value | Result |
---|---|---|
TopLeft1 |
10 | ![]() |
TopLeft2 |
11 | ![]() |
TopRight1 |
20 | ![]() |
TopRight2 |
21 | ![]() |
BottomLeft1 |
30 | ![]() |
BottomLeft2 |
31 | ![]() |
BottomRight1 |
40 | ![]() |
BottomRight2 |
41 | ![]() |
Clipping and wrapping elements
When designing OMR forms, you may run into a situation where the element does not fit on the page or inside the parent container. Aspose.OMR for .NET offers flexible handling of these edge cases through the use of Overflow
page setting.
Do not clip or wrap content
Overflow content is rendered outside the bounds of the parent element. This can result in content overlapping with other elements or being clipped at page boundaries.
This is the default rendering method.
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
Overflow = new Aspose.OMR.Generation.OverflowActions.NoClip()
};
Hide content outside of parent’s bounds
Overflow content will be invisible. Cropping will be done both horizontally and vertically. This may result in some content (images, bubbles, text, and so on) not being presented in the rendered OMR form.
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
Overflow = new Aspose.OMR.Generation.OverflowActions.Clip()
};
Wrap content
Content that does not match the parent’s bounds will automatically appear in the next column. This rendering method only applies to multi-column layouts and cannot slice monolithic elements such as images and barcodes.
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
Overflow = new Aspose.OMR.Generation.OverflowActions.Wrap()
};
Form localization
The WritingSystem
property controls the text direction (LTR or RTL) and item numbering of generated OMR forms. It is provided as an instance of one of the following classes:
Value | Default | Text direction | Item numbering |
---|---|---|---|
Aspose.OMR.Generation.WritingSystems.Arabic |
Right-to-left (RTL) | useNativeNumber = true - Eastern Arabic (٠, ١, ٢, ٣, ٤, ٥, ٦, ٧, ٨, ٩)useNativeNumber = false - Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
Aspose.OMR.Generation.WritingSystems.Bengali |
Left-to-right (LTR) | useNativeNumber = true - Bengali (০, ১, ২, ৩, ৪, ৫, ৬, ৭, ৮, ৯)useNativeNumber = false - Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
Aspose.OMR.Generation.WritingSystems.Hebrew |
Right-to-left (RTL) | useNativeNumber = true - Hebrew alphabetic numeral systemuseNativeNumber = false - Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
Aspose.OMR.Generation.WritingSystems.Persian |
Right-to-left (RTL) | useNativeNumber = true - Persian (۰, ۱, ۲, ۳, ۴, ۵, ۶, ۷, ۸, ۹)useNativeNumber = false - Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
Aspose.OMR.Generation.WritingSystems.Urdu |
Right-to-left (RTL) | useNativeNumber = true - Urdu (۰, ١, ۲, ۳, ۴, ۵, ۶, ۷, ۸, ۹)useNativeNumber = false - Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
Aspose.OMR.Generation.WritingSystems.Western |
Yes | Left-to-right (LTR) | Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) |
Arabic answer sheet
Right-to-left answer sheet with Eastern Arabic numbering.
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
WritingSystem = new Aspose.OMR.Generation.WritingSystems.Arabic(true)
};
Example
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings() {
PaperSize = Aspose.OMR.Generation.PaperSize.Tabloid,
Orientation = Aspose.OMR.Generation.Orientation.Horizontal,
BubbleColor= Aspose.OMR.Generation.Color.Red,
ImagesPaths = new string[] {
@"c:\images\aspose-logo.png",
@"c:\images\vignette.png"
}
};