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.
RotationPointPosition Aspose.OMR.Generation.RotationPointPosition Below the top-right square positioning marker The placement of the rectangular positioning 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.
  • DrawOver (default) - draw long words until a space or end of line is encountered, even outside the bounds of an element.
  • ThrowException - throw an exception when rendering the form if the long word does not fit the width of the parent element. The form will not be generated.

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

Positioning marker placement

The RotationPointPosition property controls the placement of the rectangular positioning 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 Below the top-left square positioning marker
TopLeft2 11 To the right of the top-left square positioning marker
TopRight1 20 Below the top-right square positioning marker
TopRight2 21 To the left of the top-left square positioning marker
BottomLeft1 30 Above the bottom-left square positioning marker
BottomLeft2 31 To the right of the bottom-left square positioning marker
BottomRight1 40 Above the bottom-right square positioning marker
BottomRight2 41 To the left of the bottom-right square positioning marker

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()
};

Do not clip content

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()
};

Do not clip content

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()
};

Move overlapping content on the next column

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 system
useNativeNumber = 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)
};

Arabic answer sheet

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"
	}
};