Impact Printer OSX

Kelly Burgess kellyb at
Wed Jan 13 03:23:52 EST 2010

>Hmm, so what are you sending the remote Mac?  The whole invoice text 
>or just the invoice number so that the remote Mac can do the lookup 
>of data and then print using Omnis, etc?

I'm sending the entire set of bytes that the printer will get. I've 
got a method in the printer object subclass that builds the lines 
based on their section and line numbers, and that method knows how 
and when to insert escape sequences to adjust the position

   ;  assemble name/address field
   Calculate scratch as con(mid(cusName,1,20),'  ',cusAddress)
   ;  make section 1 line 1 -- name+address, invoice#, sold to
   Do tML490.$makeLineString(1,1,kTrue,scratch,iInvNumber,cusName) 
Returns lineText
   Calculate headerText as con(headerText,lineText)  ;; add line 1

Inside $makeLineString it might detect that it's just assembled line 
2 of the header section, so it needs to
   ;  drop 9/180ths inch to line up with prompt on form
   Do method prefixWithRollForward (lineText,9)

Then there's a $getConfigString method that puts a bunch of escape 
codes together to start the header:
   ;  build a config string for the Okidata ML490...
   Do method addProportionalOnOff (configString,kFalse)     ;; Monospaced
   Do method addUnidirectionalOnOff (configString,kFalse)     ;; Bidirectional
   Do method addSetRightMargin (configString,132)     ;; right margin 
132 (character spaces past home)
   Do method addSetLeftMargin (configString,0)     ;; left margin 0 
(character spaces past home)
   Do method add6LPIOnOff (configString,kTrue)     ;; 6 lines per inch
   Do method add12pitch (configString)     ;; 12 characters per inch
   If pIsStatementForm
     Do method addPageHeightInLines (configString,51)     ;; 8.5 inch 
statement forms -- 51 lines at 6 lines/inch
     Do method addPageHeightInInches (configString,7)     ;; 7 inch 
invoice forms
   End If
   Do method addLQtypeface (configString,2)     ;; Courier
   Do method addNLQOnOff (configString,kFalse)     ;; NLQ off
   Do method addHSDDraftFontOnOff (configString,kFalse)     ;; Utility 
draft font, not HSD
   Do method addCharacterStyle (configString,0)     ;; set Normal 
character style
   Do method addCompressedOnOff (configString,kFalse)     ;; No 
compressed character width
   Do method addUnderliningOnOff (configString,kFalse)     ;; No underlining
   Do method addItalicsOnOff (configString,kFalse)     ;; No italics
   Quit method configString     ;; return the string for sending to the printer

And those methods are mostly one-liners like

   ;  Okidata escape sequence for setting 12 cpi (Elite) pitch
   Calculate pConfigString as con(pConfigString,chr(27,77))

So I assemble the whole invoice, UUencode it to protect the escape 
sequences and make Applescript happy with the data, and off it goes. 
UUdecode it on the other end and dump it to the printer.


More information about the omnisdev-en mailing list