function Main()
local oPrn, oFont
local nRowStep, nColStep
local nRow := 0, nCol := 0, n, m
local cModel := "Hp Laserjet 1018"
// PrnSetSize( 2100, 1200 ) To adjust a different printer paper size!
PRINT oPrn NAME "Testing the printer object from FiveWin" PREVIEW TO cModel //"Hp Laserjet 1018"
//cModel = oPrn:GetModel() + "," + oPrn:GetDriver() + "," + oPrn:GetPort()+","
? cModel
MsgInfo( GETPROFSTRING( "Devices", Upper(cModel), "" ) )
MsgInfo( StrToken( GetProfString( "Devices", cModel, "" ), 1, "," ) )
MsgInfo( StrToken( GetProfString( "Devices", cModel, "" ), 2, "," ) )
// Añado en el ejemplo
oPrn:hDC = PrinterDcFromName( StrToken( GetProfString( "Devices", cModel, "" ), 1,;
"," ), cModel, StrToken( GetProfString( "Devices", cModel, "" ), 2, "," ) )
if Empty( oPrn:hDC )
return nil // Printer was not installed or ready
endif
.../...
if lUser
::hDC := GetPrintDC( GetActiveWindow(), lSelection, PrnGetPagNums() )
if ::hDC != 0
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
endif
elseif cModel == nil
::hDC := GetPrintDefault( GetActiveWindow() )
if ::hDC != 0
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
endif
else
::hDC = PrinterDcFromName( , cModel, ) // cambia aqui !!!
endif
function PrintBegin( cDoc, lUser, lPreview, xModel, lModal, lSelection, cFile )
local cText, aPrn, nScan
if xModel == nil
return oPrinter := TPrinter():New( cDoc, lUser, lPreview,, lModal, lSelection, cFile )
endif
cText = StrTran( GetProfString( "Devices" ), Chr( 0 ), Chr( 13 ) + Chr( 10 ) )
aPrn = Array( MlCount( cText, 250 ) )
AEval( aPrn, { | v, n | aPrn[ n ] := Trim( MemoLine( cText, 250, n ) ) } )
if Valtype( xModel ) == "N"
if xModel < 0 .or. xModel > Len( aPrn )
nScan = 0
else
nScan = xModel
endif
else
if ( nScan := Ascan( aPrn, { | v | Upper( xModel ) == Upper( v ) } ) ) == 0
nScan = Ascan( aPrn, { | v | Upper( xModel ) $ Upper( v ) } )
endif
endif
if nScan == 0
MsgBeep()
return oPrinter := TPrinter():New( cDoc, .T., lPreview,, lModal, lSelection, cFile )
endif
return oPrinter := TPrinter():New( cDoc, .f., lPreview, aPrn[ nScan ], lModal,;
lSelection, cFile )
#include "FiveWin.ch"
function Main()
local oPrn
PRINTER oPrn PREVIEW TO "XPS"
PAGE
oPrn:Say( 1, 1, "Hello world" )
ENDPAGE
ENDPRINTER
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 47 guests