Can anybody guide me how to print the images exactly at the desired
row, col co-ordinates (whether in pixels or Cm) on different printers with different resolutions.
With the following code I got this out using different printers with different
printer resolutions:
Code: Select all
#include "FiveWin.ch"
#define PAD_LEFT 0
#define PAD_RIGHT 1
#define PAD_CENTER 2
FUNCTION Main()
LOCAL oPrn, oPen, oFont, oFont1, oFont2, oFont3
LOCAL pno := 1, nLs := 0, n, nLinI, nColI, nLinF, nColF,nColL
LOCAL aRowCol := {}, aData := {}
******
FOR n = 1 TO 90
AADD(aData,{"1234","12345",REPLI("A",20),REPLI("B",20), "C", REPLI("D",8),REPLI("E",8), "99/99/9999", "99/99/9999"})
NEXT
PRINT oPrn NAME "Testing Windows Printing" PREVIEW FROM USER
DEFINE PEN oPen WIDTH 2 OF oPrn
DEFINE FONT oFont NAME "Arial Bold" SIZE 0, -16 OF oPrn
DEFINE FONT oFont1 NAME "Arial Italic" SIZE 0, - 8 OF oPrn
DEFINE FONT oFont2 NAME "Arial Bold" SIZE 0, - 9 OF oPrn
DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 8 OF oPrn
oPrn:SetPage(9)
oPrn:SetPortrait()
PAGE
nLinI := 03.75
nLinF := 27.25
IF .NOT. OS_IsWinXP()
nColI := 01.00
nColF := 20.75
nColL := 00.20
ELSE
nColI := 00.70
nColF := 20.25
nColL := 00.45
ENDIF
oPrn:Cmtr2Pix(@nLinI, @nColI)
oPrn:cmtr2Pix(@nLinF, @nColF)
aRowCol := oPrn:Cmtr2Pix(1,1)
oPrn:SayBitmap(aRowCol[1], aRowCol[2],"c:\fwh\bitmaps\fivewin.bmp") //, 131, 168)
oPrn:CmSay(1.00, 10.50-nColL, "NAME OF THE COMPANY", oFont,,CLR_BLACK,,PAD_CENTER )
oPrn:CmSay(1.55, 10.50-nColL, "This is the place where address of the company is printed", oFont1,,CLR_BLACK,,PAD_CENTER )
oPrn:CmSay(2.15, 10.50-nColL, "THIS IS THE HEADING OF REPORT", oFont2,,CLR_BLACK,,PAD_CENTER )
oPrn:Box(nLinI, nColI, nLinF, nColF, oPen )
oPrn:Box(nLinI-(oFont2:nHeight()*2.75), nColI, nLinI+(oFont2:nHeight()*.75), nColF, oPen )
oPrn:CmSay(3.05,01.35-nColL,"SL.", oFont2)
oPrn:CmSay(3.05,02.15-nColL,"AAAA", oFont2)
oPrn:CmSay(3.05,03.25-nColL,"BBBB", oFont2)
oPrn:CmSay(3.05,04.55-nColL,"CCCCCCCCCCCCCCCCC", oFont2)
oPrn:CmSay(3.05,08.60-nColL,"DDDDDDDDDDDDD", oFont2)
oPrn:CmSay(3.05,12.70-nColL,"EEE", oFont2)
oPrn:CmSay(3.05,13.60-nColL,"FFFFFFF", oFont2)
oPrn:CmSay(3.05,15.70-nColL,"GGGGGGG", oFont2)
oPrn:CmSay(3.05,17.60-nColL,"HHHHHH", oFont2)
oPrn:CmSay(3.05,19.25-nColL,"KKKKKK", oFont2)
oPrn:CmSay(3.50,01.35-nColL,"NO.", oFont2)
oPrn:CmSay(3.50,02.15-nColL,"AAA", oFont2)
oPrn:CmSay(3.50,03.25-nColL,"BBB", oFont2)
FOR n = 1 TO LEN(aData)
oPrn:CmSay(4.50+nLs,01.35-nColL, STR(n,3,0), oFont3 )
oPrn:CmSay(4.50+nLs,02.15-nColL, aData[n,1],oFont3)
oPrn:CmSay(4.50+nLs,03.25-nColL, aData[n,2],oFont3)
oPrn:CmSay(4.50+nLs,04.55-nColL, aData[n,3],oFont3)
oPrn:CmSay(4.50+nLs,08.60-nColL, aData[n,4],oFont3)
oPrn:CmSay(4.50+nLs,12.85-nColL, aData[n,5],oFont3)
oPrn:CmSay(4.50+nLs,13.50-nColL, aData[n,6],oFont3)
oPrn:CmSay(4.50+nLs,15.70-nColL, aData[n,7],oFont3)
oPrn:CmSay(4.50+nLs,17.60-nColL, aData[n,8],oFont3)
oPrn:CmSay(4.50+nLs,19.25-nColL, aData[n,9],oFont3)
nLs := nLs + .50
IF nLs > 22
oPrn:CmSay(27.25,20.90-nColL,"Contd .. "+LTRIM(STR(pno))+"/", oFont3,,CLR_BLACK,,PAD_RIGHT)
ENDPAGE
PAGE
pno ++
oPrn:CmSay(1.00, 10.50-nColL, "Page No. "+LTRIM(STR(pno)), oFont2,,CLR_BLACK,,PAD_CENTER )
oPrn:CmSay(1.80, 10.50-nColL, "THIS IS THE HEADING OF REPORT", oFont2,,CLR_BLACK,,PAD_CENTER )
oPrn:Box(nLinI, nColI, nLinF, nColF, oPen )
oPrn:Box(nLinI-(oFont2:nHeight()*2.75), nColI, nLinI+(oFont2:nHeight()*.75), nColF, oPen )
oPrn:CmSay(3.05,01.35-nColL,"SL.", oFont2)
oPrn:CmSay(3.05,02.15-nColL,"AAAA", oFont2)
oPrn:CmSay(3.05,03.25-nColL,"BBBB", oFont2)
oPrn:CmSay(3.05,04.55-nColL,"CCCCCCCCCCCCCCCC", oFont2)
oPrn:CmSay(3.05,08.60-nColL,"DDDDDDDDDDDDD", oFont2)
oPrn:CmSay(3.05,12.70-nColL,"EEE", oFont2)
oPrn:CmSay(3.05,13.60-nColL,"FFFFFFF", oFont2)
oPrn:CmSay(3.05,15.70-nColL,"GGGGGGG", oFont2)
oPrn:CmSay(3.05,17.60-nColL,"HHHHHH", oFont2)
oPrn:CmSay(3.05,19.25-nColL,"KKKKKK", oFont2)
oPrn:CmSay(3.50,01.35-nColL,"NO.", oFont2)
oPrn:CmSay(3.50,02.15-nColL,"AAA", oFont2)
oPrn:CmSay(3.50,03.25-nColL,"BBB", oFont2)
nLs := 0
ENDIF
NEXT
ENDPAGE
ENDPRINT
RETURN nil
- Ramesh Babu P