How to Add Answer Areas Manually in Custom Designed OMR Forms

Overview of the sqm file

You should learn how to write your own OMR master file, which is called sqm file. The sqm file contains mark area position information and OMR metadata.

SourceEditor generates a pdf file with 2 attachment files: sqs(SQS questionnaire source file) and sqm(SQS questionnaire master file).
The sqm file in a pdf file can be replaced with your manually modified sqm file.
Thus, you can design your own OMR form with using any kind of DTP applications, if you can create your sqm file manually with your text editors or xml editors.

In such cases, you can put a bare sqm file(with ".sqm" suffix) into your source folder which is to be processed by MarkReader.
The bare sqm file in your folder will be work as a substitute of the pdf file with the 2 attachment files.

First, you should extract a sqm file of your OMR form pdf file. It can be used as a template.

Inside the sqm file

Extension of SVG Print format

An sqm data is mark-upped as an XML instance. Its host language is W3C SVG Print and extended with W3C XForms and SQS original vocabulary.

There are a page set structure, the same as SVG Print format. There are one svg:masterPage element and one or more svg:page elements in it.

The coordinates of the origin point is at the upper-left corner of the page, the same as SVG image's coordinate of the origin point is at the upper-left.


(0,0)______________
  |               |__
  |               | |__
  |               | | |__
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  |               | | | |
  ~|~~~~~~~~~~~~~~~ | | |
    ~|~~~~~~~~~~~~~~  | |
     ~~|~~~~~~~~~~~~~~  |
       ~~~~~~~~~~~~~~~~~~

Page width, height and the coordinates

At the begging of the sqm file, there are the page width and height definitions as follows:

 svg:width="595" svg:height="842" 

In this example, the width and height values are calculated the image size of a PDF page rendered at 72 dpi.
The following coordinate values in this article are proportion to this page width and page height.

The corner black rectangle definitions

In sqm file, there are some point definitions in master page:

  • corner data (4 point)
  • upsidedownchecker (2 rect)
  • evenoddchecker (2 rect)

At 72 dpi, the corner points are positioned as following illustration:

(0,0)____________________
  |                     |__
  | (99,29)   (497,29)  | |__
  |   ##1         ##2   | | |__
  |                     | | | | 
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |                     | | | |
  |   !#3          !#4    | | | |
  | (94,810)   (492,810)| | | |
  |                     | | | |
  ~|~~~~~~~~~~~~~~~(594,841)| |
   ~~|~~~~~~~~~~~~~~~~~~~~~ | |
     ~~|~~~~~~~~~~~~~~~~~~~~~ |
       ~~~~~~~~~~~~~~~~~~~~~~~~

The upside down checker

It is very often that there are some upside down sheets in your heap of OMR form sheets to be scanned.
To find out the the upside down OMR form sheets, the black rectangles at the upper left corner and at the lower left corner are distinguished by their width. The lower black rectangles are half width of upper black rectangles. So you must point the position of the upper left and the lower left black rectangles.

The even odd checker

You can print your OMR form on dual-side of your sheet if it has 2 or more pages per a respondent.
On the ODD page, there is a "page number area" at the bottom RIGHT corner.
On the other hand, on the EVEN page, there is at the bottom LEFT corner.
Suppose you scan a heap of OMR form sheet. They should be scanned correctly like this:

 ODD, EVEN, ODD, EVEN, ODD, EVEN, ...

However, sometimes they might be scanned like this:
ODD, EVEN, EVEN, ODD, ODD, EVEN, ...

This shows that the second sheet might be accidentally reversed.
So you must point the positions of the page number areas, at the bottom LEFT corner and the bottom RIGHT corner.

You can disable them by comment out <upsideDownChecker/> element and/or <evenOddChecker/> element in your sqm file.

mark areas and their locations

In sqm file, mark areas and their locations are defined as follows:

 <svg:rect svg:x="84" svg:y="800" svg:width="4" svg:height="12">
   <svg:metadata>
      .....
   </svg:metadata>
 </svg:rect>

It may be easy to render the page set of your OMR form pdf file into bitmap image files at 72 dpi, and then, pick-up the x,y,width,height values.

questionnaire item definitions

You must rewrite some sets of svg:metadata/xforms:select elements in your svg:rect elements, too.

... under construction ...


よく、「学籍番号欄をどうやって作ったらよいでしょうか?」と聞かれます。

学籍番号欄に限らず、「もっといろいろな体裁での帳票を作りたい」
という要望が寄せられておりますが、他に優先度の高い機能開発が
あることなどから、個人的には、このための時間が取れずにおります。
Java(Swing), XMLについて知識のある技術者で、
手伝ってくれる方がいるといいのですが…。
あるいは、どうしても今すぐ学籍番号欄の読み取りを実現したいならば…、
SourceEditorは、調査票のPDFファイルを作成するときに、
同時に「SQM形式」と名づけているXMLデータを作成して、
PDFファイルに添付しています。
このSQMデータは、W3C標準のSVG Printという形式を基本としていて、
ページの中のひとつひとつのマークの位置をsvg:rectというタグで定義し、
さらに、svg:metadataというタグの中に、設問の型情報などを、
W3C標準のXFormsという形式て記述するといったような内容になっています。
ようするに、このファイルを自作すればよいのです。
そのためには、まずは、
SourceEditorで作成したPDFファイルをAdobe Illustratorなどで読み込み、
その余白の部分に学籍番号欄を描き足したPDFをつくります。
これが、印刷原稿になります。
次に、このPDFを、
ページ全体を72dpiでラスタライズしたビットマップ画像を作成します。
この画像の中の、自分が描き足した学籍番号のマーク欄のひとつひとつの
マークについて、x,y,width,heightの数字を拾ってメモしておきます。
そうしてメモしておいた数字を使って、SQM形式のデータの中に、
svg:rectのタグを、自分が描き足したマークの数だけ、
見よう見まねで書き足してやればOK、ということになります。
ちなみにぼく自身、
択一選択式設問中の最後の設問を「その他:(   )」というようにしておいて
PDFを生成し、ここに添付されたSQMファイルを開いて編集し、
「その他」の括弧部分の位置に相当するsvg:rectを書き足して、
そのsvg:metadata内には自由記述式設問を表したxforms:textareaを指定する…
といったようなことを、ときどきやります。