An Oracle blog about BI Publisher

Adding OMR Marks

We had a question come up on an internal mailing list yesterday that got me thinking. Can BIP/XMLP add OMR marks to documents? For the uninitiated, OMR, or Optical Mark Recognition, in one of its simpler forms is the series of 'slugs' (technical term) you see on the right hand side of your paper phone bill. They are short 1/2 inch (1.2cm ... sorry Europe Im all inches now :) lines that tell a paper folding machine where to fold the paper prior to sticking the sheets into an envelope.

This is not the only application of OMR, the routing and account numbers on checks are of the same ilk i.e. machine readable. I have covered checks in other postings and there is a white paper on the BIP OTN pages. Those of you in Europe and maybe the rest of the world that have taken 'multiple guess', sorry 'multiple choice' (MC) exam papers and have had to fill in the appropriate ellipse shape corresponding to what you think is the correct answer are using OMR technology.
I always thought these were the easiest exams until I got to university. My Applied Chemistry professor announced to a greatly relieved class that our mid and final term papers would be in a multiple choice format ... fan-tas-tic! Oh how wrong we were! My experience of MC thus far had been of the four choices, you could throw out one as being completely ridiculous. As long as you knew something on the subject, another two were 'dodgy' so that left the correct answer - easy right. Our professor put a twist on the format:

  • We had 200 questions

  • 5 choices not 4 - none of which were obviously wrong

  • Get a question incorrect and you lost 2 points, dont answer and lose 1 point - this was done to put off the student who hedged their bets and relied on the 20% chance that they would get questions right if they picked ABCDEABCDEABCDE .... we had some real high achievers in our classes :o)
Maybe it was not quite that nasty ... still it gave you huge incentive to learn the material and we covered so much information in the two hours a week we had with her that your hand would be cramping by the time class finished or you'd be begging classmates for a copy of their unintelligible notes. Anyway, I passed ... lesson learned, 'if you see MC be waryee' a mantra I have lived by since.

Slugging Options

Anyway, I digress ... badly. So, just how can you add those marks to your output? 
There are commercial OMR fonts out on the market but for the purposes of marking paper for folding we have found that you can either use the '-' or '_' characters or a simple line drawing to creat the slug. All of the 'folding' manufacturers publish the dimensions of the the slug they need so its just a case of changing the font size or the line thickness/length to the desired size. There are a couple of options both work but it depends on your requirements.
a. Some machines just require marks to tell it where to fold, maybe 2 or 3 per page or
b. Requirements are more sophisticated, checksum slugs that need to appear only on the last page or on eavery X number of pages.

  • Use line drawings - I have covered elsewhere how you can manipulate drawings in the RTF templates. You can use the same technique to create the necessary 'slugs' and then repeat them down the page on every page unless you put in a section break. This method can and does work for 'a'

  • Use PDF APIs - assume your PDF has been generated. You can now use the PDF APIs, taking advatage of the watermarking method you can add the slug to specific x,y positions on particular pages. We have customers using this method combined with the page counting API and the bursting engine.

    1. Burst a set of documents and subscribe to the BurstListener,

    2. as the document is generated, grab it, count the pages - FormProcessor.getPageNumber() 

    3. calculate where and then apply the 'slugs' to each page appropriately - PDFDocMerger.setTextXXXX - where XXXX are the methods to set text, font and position. 

    4. deliver document to paper folder

You do not have to use the bursting engine to add the marks. You can add them to any PDF document, you could create a printer driver that called the API prior to sending the document to the printer so you do not have to interrupt or meddle with the concurrent manager - I covered how to do this in the EBS Delivery series.

Of the two, 1 is simpler but of course only meets the simpler requirements. Option 2 requires java (simple java mind you) and a little custom work but its well within your means.
Happy Slugging!

Join the discussion

Comments ( 3 )
  • sanjai misra Sunday, July 19, 2009
    I need to print OMR marks in our invoice report and i am not sure how to do it. I will highly appreciate your inputs.
    I have to print OMR mark a per the logic given below
    1. Divide the page number by 15
    2. Based on remainder value, print 4 horizontal lines. For example,
    if remainder is 1 then print only line 1,
    if remainder is 2 then print only line 2.
    if remainder is 3 then print line 1 and line 2.
    If remainder is 4 then print only line 3,
    if remainder is 5 then print line 1 and line 3
    if remainder is 6 then print line 2 and line 3
    if remainder is 7 then print line 1, 2, 3
    if remainder is 8 then print only line 4 and so on
    if remainder is 0 then print all lines i.e. line 1,2,3 and 4.
    Could you please tell me how could i achieve this. if you have some code that you could share, it would be great.
    sanjai misra
  • iwishiwasinmygarden Wednesday, September 16, 2009
    What you are being asked to produce are OMR marks for a wraparound sequence (WAS). Your WAS is representing the numbers 1 to 15 in binary and is used as an integrity check by the insertion machine to ensure that the invoices have been printed correctly. Page number 16 would restart the sequence at 1, which is why you are using the modulus of 15 to work out which binary value to display. Just imagine the presence of a line in a particular position on your invoice would indicate a 1, and the absence of a line in the same position indicates a 0. You would have four slots on your invoice in which to draw your lines.
    Your code simply works out which lines to draw depending on the number you supply (1 - 15).
    As an aside, there is no reason why your wraparound sequence could not start from 0 and increment to 15, where 0 would be represented by no lines in any of the four available positions on the invoice page.
    And don't forget that your invoices might be duplex printed, so you might want to add logic to only produce OMR marks on the front side of the paper!
    Have fun!
  • Krishna Wednesday, November 4, 2009
    Is it possible to have OMR Marks on the front side of the paper in duplex printing. If Yes, what are the approaches?
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.