Send OMR form source code for generation

To generate a printable OMR form from a source code, send a POST request to the https://api.aspose.cloud/v5.0/omr/GenerateTemplate/PostGenerateTemplate Aspose.OMR Cloud REST API endpoint. To authorize the request, pass the access token in Authorization header (Bearer authentication).

The source code and rendering parameters are provided in JSON format in the request body.

{
  "MarkupFile": "Source code as Base64 string",
  "Images": {
  	"image1.png": "Base64 encoded image file",
  	"image2.png": "Base64 encoded image file"
  },
  "settings": {
  	"FontFamily": "Arial",
  	"FontStyle": "Regular",
  	"FontSize": 15,
  	"PaperSize": "A4",
  	"BubbleColor": "Red",
  	"PageMarginLeft": 50,
  	"Orientation": "Vertical",
  	"BubbleSize": "Normal"
  }
}

Providing source code

The form’s source code is provided in a value of MarkupFile property as a Base64 encoded string.

Providing images

If the OMR form contains images, they must be provided as Images property entries, where the image filename referenced in the source code is the key and the Base64-encoded content of the image file is the value.

Rendering parameters

The paper size, orientation, font, and other global layout settings are configured through Settings property.

Setting Type Values Description
PaperSize string
  • A4 (210 x 297 mm, 2480 x 3508 pixels)
  • Letter (215.9 x 279.4 mm, 2551 x 3295 pixels)
  • Legal (215.9 x 355.6 mm, 2551 x 4205 pixels)
Physical page size.
Orientation string
  • Horizontal (landscape)
  • Vertical (portrait)
Page orientation.
PageMarginLeft number Number of pixels. The width of the left page margin in pixels.
FontFamily string Font name. Check the list of supported fonts. Font family for all texts, except for those directly overridden in the source code. For example, Courier New.
You can only use fonts that are supported in the cloud!
FontSize number Font size in pixels. Font size for all texts, except for those directly overridden in the source code.
FontStyle string
  • Regular
  • Bold
  • Italic
  • Underline
  • Strikeout
Font style for all texts, except for those directly overridden in the source code.
BubbleColor string One of the supported color codes. Color of all answer bubbles in the form.
BubbleSize string
  • Extrasmall (40 pixels)
  • Small (50 pixels)
  • Normal (60 pixels)
  • Large (80 pixels)
  • Extralarge (100 pixels)
Size of answer bubbles, except for those directly overridden in the source code.

Return value

If successful, this method returns a string with a unique identifier (GUID) of the form generation request in the queue.

Otherwise, it returns a HTTP status code corresponding to the error.

What’s next

Form generation will take a few seconds, depending on the complexity of the form, number of images, and the current Aspose.Cloud load. See the article Fetch printable form for information on how to get a machine-readable form image and a recognition pattern from the server.

cURL example