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.
PageMarginLeft 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.

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.Western Yes Left-to-right (LTR) Western (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
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.Persian Right-to-left (RTL) useNativeNumber = true - Persian (۰, ۱, ۲, ۳, ۴, ۵, ۶, ۷, ۸, ۹)
useNativeNumber = false - 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"
	}
};