Hua,
sayBitmap( nRow, nCol, cBitmap, nWidth, nHeight, nRaster )
nRow, nCol, nWidth, and nHeight are in pixels. Each printer may have a different resolution, i.e. pixels per inch, so you have to calculate these values for each printer.
Actually there is another issue. Each printer may have a different vertical and horizontal "offset." These are the sections of the page along the borders that the printer cannot print on. Like resolution, these offsets may be different for each printer.
I forgot to include these offsets in my calculations. However, you can use the built in method in TPrinter which does include these offsets. See the Inch2Pix( nRow, nCol) method of TPrinter. It returns an array {nRow, nCol}. So you could do something like:
- Code: Select all Expand view
oPrn:sayBitmap( oPrn:Inch2Pix(nRow, nCol):[1], ;
oPrn:Inch2Pix(nRow, nCol):[2], ;
cBitmap, ;
oPrn:Inch2Pix(nWidth, nHeight):[1], ;
oPrn:Inch2Pix(nWidth, nHeight):[2] )
Where nRow, nCol, nWidth, nHeight are all in inches.
There are also Cmtr2Pix() and Mmtr2Pix() methods if you prefer to use those.
Regards,
James