RS2 JiT compiler - Dotmatrix printer driver processing
© RedTitan Technology 2022
It is difficult to recover dot matrix character images as text using OCR techniques.
Discontinuities in stem thicknesses will cause recognition errors. EscapeE uses the generic
scripting plugin (RS2) to provide a simple text field recovery mechanism for dot matrix text mages.
This provides a fast way of reprocessing legacy applications as full text searchable
PDF files (particularily using RedTitan parallel port conversion hardware applications)
The typical character "black width" in dot matrix pixels is 5 and an individual character
is set in 7 pixels width - the space width is 7. EscapeE scales the output to match the original printer rendition.
For an EPSON printer the scale is 8.34x10. The script resamples a field image at this scale and compares individual characters
to a database. e.g. The "3" character database entry.
CHARACTER
name=3
value=0033
margin-top=0
margin-bottom=0
-***-
*---*
----*
--**-
----*
*---*
-***-
The EscapeE EVALUATE plugin configuration dialogue includes a wizard to automatiaclly create
an RS2 script that will process all defined fields using the DOTMATRIX function. e.g.
// REDTITAN RS2 CONTROL
// Edit below - click "add" to create prototype program statement
// Escape scripting control generated by Evaluate wizard Thu 15-Mar-2012 10:33:00
// Publish location of the evaluate plugin field
fieldname:="FIELD1";
xpos:=fieldLeft(fieldname);
ypos:=fieldTop(fieldname);
width:=fieldWidth(fieldname);
function dotm(fieldname:string):string;
begin
lc:=[];
L:=[];
xpos:=fieldLeft(fieldname);
ypos:=fieldTop(fieldname);
w:=fieldwidth(fieldname);
h:=fieldheight(fieldname);
i:=dotmatrix(fieldname,"C:\RedTitan\epson.dmb",L);
if i=-3 then showmessage("Database not found") else
begin
if i<0 then
showmessage("DATABASE contains unknown characters "#10"Check with DMDB "+inttostr(i)+" "+fieldname);
end;
assign(lc,0,w);
th:=tab(xpos,ypos,lc,h); // single column table, same width as field
brush(255,255,255); // 255,255,255 is white
box(th); // fill field box with colour
font(14,"Courier","");
text(xpos+17,ypos+100,L); // replace with recognised text
end;
// attempt to recognise all defined fields as dot matrix characters
lf:=[];
i:=fields(lf);
for ix:=0 to pred(i) do dotm(list_strings(lf,ix));