I Occaso
I send you an example of mine, about use of printer, with Harbour.
You can use the object Win_Prn()
Regards
Giovanni Di Maria
#include "
common.ch"
#include "
hbwin.ch"
PROCEDURE Main( cPar1 )
LOCAL k,nPrn := 1
LOCAL aPrn := WIN_PRINTERLIST()
LOCAL oPrinter
//---------------------------------------------------
CLS
nPrn := AChoice( 3, 1, 15 ,70, aPrn)
cls
? "Stai stampando su ",aPrn[nPrn]
//---------------------------------------------------
oPrinter := Win_Prn():New( aPrn[nPrn] )
oPrinter:Landscape := .F.
oPrinter:FormType := WIN_DMPAPER_A4
oPrinter:Copies := 1
//---------------------------------------------------
oPrinter:Create()
oPrinter:startDoc( "stampa" )
oPrinter:SetPen( WIN_PS_SOLID, 1, HB_WIN_RGB_RED )
//---------------------------------------------------
oPrinter:Bold( WIN_FW_EXTRABOLD )
oPrinter:NewLine()
oPrinter:TextOut( "Giovanni Bold" )
//---------------------------------------------------
oPrinter:Bold( WIN_FW_DONTCARE )
oPrinter:NewLine()
oPrinter:TextOut("Giovanni Bold 2")
//---------------------------------------------------
oPrinter:NewLine()
oPrinter:UnderLine( .T. )
oPrinter:Italic( .T. )
oPrinter:SetFont( "Courier New", 7, { 3, -50 } ) // Compressed
print
oPrinter:TextOut( "Testina" )
//---------------------------------------------------
oPrinter:SetPrc( oPrinter:Prow() + 3, 20 )
oPrinter:Bold( WIN_FW_DONTCARE )
oPrinter:TextOut( "Salve MONDO" )
//---------------------------------------------------
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:UnderLine( .F. )
oPrinter:Italic( .F. )
oPrinter:Bold( WIN_FW_DONTCARE )
oPrinter:SetFont( "Arial", 10, 0 )
oPrinter:SetColor( HB_WIN_RGB_BLACK )
for k=1 to 10
oPrinter:TextOut( "Numero in stampa: " + str(k) )
oPrinter:NewLine()
next k
//---------------------------------------------------
oPrinter:NewLine()
oPrinter:NewLine()
oPrinter:SetFont( "Lucida Console", 18, 0 ) // Large print
oPrinter:SetColor( HB_WIN_RGB_GREEN )
oPrinter:TextOut( "FORME GEOMETRICHE" )
oPrinter:Box( 0, oPrinter:PosY + 100, 100, oPrinter:PosY + 200 )
oPrinter:Arc( 200, oPrinter:PosY + 100, 300, oPrinter:PosY + 200 )
oPrinter:Ellipse( 400, oPrinter:PosY + 100, 500, oPrinter:PosY +
200 )
oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY +
200, HB_WIN_RGB_RED )
//---------------------------------------------------
oPrinter:EndDoc()
oPrinter:Destroy()
RETURN