Gracias Karinha, haciendo las modificaciones en las lineas 10, 31 y 49 anduvo todo bien. La linea 10 por cuestiones obvias, la 31 provocaba el cambio no deseado de la impresora por default de windows y la 49 por la misma razon. Vevificada la 49 en el fuente de printer.prg del mes 8 del 2010 y del mes 8 de 2013.
Muchas gracias.
Andres
- Code: Select all Expand view
METHOD New( cDocument, lUser, lPreview, cModel, lModal, lSelection, cFile ) CLASS TPrinter
local aOffset
local cPrinter
DEFAULT cDocument := "FiveWin Report" ,;
lUser := .f., lPreview := .f., lModal := .f., lSelection := .f.
// lPreview := .t. Modificado 29/01/2016
if lUser
::hDC := GetPrintDC( GetActiveWindow(), lSelection, PrnGetPagNums() )
if ::hDC != 0
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
endif
elseif cModel == nil // Modified: 16/01/2014
::hDC := GetPrintDefault( GetActiveWindow() )
//cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
// MUDEI EM: 08/03/2016 - Joao
if ::hDC != 0
cModel = ::GetModel() + "," + ::GetDriver() + "," + ::GetPort()
endif
// SetPrintDefault( cModel ) // NEW !!! // 16/01/2014 Joao Modificado 29/01/2016 Para no modificar la impresora por default
else
cPrinter := GetProfString( "windows", "device" , "" )
WriteProfString( "windows", "device", cModel )
SysRefresh()
PrinterInit()
::hDC := GetPrintDefault( GetActiveWindow() )
SysRefresh()
WriteProfString( "windows", "device", cPrinter )
// SetPrintDefault( cPrinter ) // NEW !!! Antonio Linares Modificado 29/01/2016 Para no modificar la impresora por default
endif
if ::hDC != 0
aOffset = PrnOffset( ::hDC )
::nXOffset = aOffset[ 1 ]
::nYOffset = aOffset[ 2 ]
::nOrient = ::GetOrientation()
elseif ComDlgXErr() != 0
MsgStop( "There are no printers installed!" + CRLF + ;
"Please exit this application and install a printer." )
::nXOffset = 0
::nYOffset = 0
else
::nXOffset = 0
::nYOffset = 0
::nOrient = DMORIENT_PORTRAIT
endif
::cDocument = cDocument
::cModel = cModel
::nPage = 0
::nPad = 0
::lMeta = .f.
::lPreview = lPreview
::lStarted = .F.
::lModified = .F.
::lPrvModal = lModal
if ! Empty( cFile ) .and. Lower( Right( cFile, 3 ) ) == "pdf"
::cFile = cFile
::lMeta = .t.
elseif ::lPreview
::lMeta = .t.
endif
if ! ::lMeta
::hDcOut = ::hDC
else
::aMeta = {}
::cDir = GetEnv( "TEMP" )
if Empty( ::cDir )
::cDir = GetEnv( "TMP" )
endif
if Right( ::cDir, 1 ) == "\"
::cDir = SubStr( ::cDir, 1, Len( ::cDir ) - 1 )
endif
if ! Empty( ::cDir )
if ! lIsDir( ::cDir )
::cDir = GetWinDir()
endif
else
::cDir := GetWinDir()
endif
endif
return Self