Hello Everyone,
I am having problems printing to a dot matrix printer, Okidata ML 320. I am trying to change the paper length to 12 inches which is supported by the printer. I am using the following code print a grid with rows and columns to determine placement of data on a pre-printed form.
Another problem is that the page is not form feeding to the next form once the print job is completed.
How can I get this resolved?
/*---------------------------------------------------------------------------*/
static function __grid( nLay, nWid1, nLen1 )
local oPrinter, oFont
/* Set Paper Size */
nWid := ROUND( nWid1 * 254, 0) <--- 254 is conversion to millimeters
nLen := ROUND( nLen1 * 254, 0)
PrnSetSize( nWid, nLen )
/* Select Printer */
PRINT oPrinter FROM USER PRINTER NAME "Grid Utility" PREVIEW MODAL
/* Check if Object is Empty */
if empty( oPrinter:hDC )
return nil
endif
// Font...
DEFINE FONT oFont NAME "Arial" SIZE 0,-10 OF oPrinter
/* Set to Layout */
if (nLay==1)
oPrinter:SetPortrait() // Portrait...
else
oPrinter:SetLandScape() // Landscape...
endif
/* Init vars */
Mrow = 0
Mv_max = oPrinter:nVertRes()
Mh_max = oPrinter:nHorzRes()
/* Start Printing Page */
PAGE
/* Let's Go */
FOR nX=0 TO 100
Mrow := ROUND( Mv_max * (nX/100), 0)
Mtmp = RIGHT("000"+ LTRIM(TRANSF(nX,"999")),4)
nBeg = 4
IF LTRIM(STR( MOD(nX,2),2)) ="0"
Mtmp = ""
nBeg = 1
ENDIF
FOR nY=nBeg TO 100
IF nY=nBeg
oPrinter:Say( Mrow, 1, Mtmp, oFont )
ENDIF
Mcol := ROUND( Mh_max * (nY/100), 0)
IF RIGHT(LTRIM(STR(nY,3)),1) $ "05"
M_dat = "|"
ELSE
IF nY=99
M_dat = "X"
ELSE
M_dat = "-"
ENDIF
ENDIF
oPrinter:Say( Mrow, Mcol, M_dat, oFont )
/* Counter */
Mcol += oPrinter:GetTextWidth(M_dat, oFont)
NEXT nY
NEXT nX
// Done printing...
ENDPAGE
oPrinter:SetPortrait()
ENDPRINT
nWid := ROUND( 8.5 * 254, 0)
nLen := ROUND( 11 * 254, 0)
PrnSetSize(nWid, nLen )
RETURN nil