Function u_localPrint()
Local lAdjustToLegacy := .F.
Local lDisableSetup := .T.
Local oPrinter
Local cLocal := "c:\temp"
Local nPrtType := 6 // IMP_PDF > 6 || IMP_SPOOL > 2
Local aDevice := {}
Local cSession := GetPrinterSession()
AADD(aDevice,"DISCO") // 1
AADD(aDevice,"SPOOL") // 2
AADD(aDevice,"EMAIL") // 3
AADD(aDevice,"EXCEL") // 4
AADD(aDevice,"HTML" ) // 5
AADD(aDevice,"PDF" ) // 6
cDevice := If(Empty(fwGetProfString(cSession,"PRINTTYPE","SPOOL",.T.)),"PDF",fwGetProfString(cSession,"PRINTTYPE","SPOOL",.T.))
oProfile := FWProfile():New()
oProfile:SetTask('PRINTTYPE')
cDevice := oProfile:LoadStrProfile()
nPrtType := aScan(aDevice,{|x| x == cDevice })
oPrinter := FWMSPrinter():New("exemplo", nPrtType, lAdjustToLegacy, cLocal, lDisableSetup, , , , , , .F., )
oPrinter:Say(10, 0, "teste")
oPrinter:Setup()
If oPrinter:nModalResult == PD_OK
oProfile:SetTask('PRINTTYPE')
oProfile:SetStringProfile(If(oPrinter:nDevice==2, "SPOOL", "PDF"))
oProfile:Save()
oPrinter:Preview()
EndIf
Return |