IMPRIMINDO NUMA ESTACAO DO WIN SERVER 2008
Está ocorrendo erro ao imprimir no spool, estando o aplicativo rodando em um terminal-server sob o windows server 2008.
Isso só ocorre no Terminal Server.
Obs; O erro está em anexo.
Para utilização do spool utilizo o winspool.drv, declarando as funções abaixo
Public Declare Function PrinterProperties Lib [Ô]winspool.drv[Ô] (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
Public Declare Function GetProfileString Lib [Ô]kernel32[Ô] Alias [Ô]GetProfileStringA[Ô] (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Public Declare Function OpenPrinter& Lib [Ô]winspool.drv[Ô] Alias [Ô]OpenPrinterA[Ô] (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long)
Public Declare Function StartDocPrinter& Lib [Ô]winspool.drv[Ô] Alias [Ô]StartDocPrinterA[Ô] (ByVal hPrinter As Long, ByVal level As Long, pDocInfo As DOC_INFO_1)
Public Declare Function StartPagePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function WritePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long)
Public Declare Function EndDocPrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function EndPagePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function ClosePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Para imprimir procedo desta forma:
docinfo.pDocName = [Ô]Imprimindo extrato...[Ô]
docinfo.pOutputFile = vbNullString
docinfo.pDatatype = vbNullString
jobid = StartDocPrinter(hPrinter, 1, docinfo)
Call StartPagePrinter(hPrinter)
printdata$ = StrResumo
Call WritePrinter(hPrinter, ByVal printdata$, Len(printdata$), written)
Call EndPagePrinter(hPrinter)
Call EndDocPrinter(hPrinter)
Call ClosePrinter(hPrinter)
Isso só ocorre no Terminal Server.
Obs; O erro está em anexo.
Para utilização do spool utilizo o winspool.drv, declarando as funções abaixo
Public Declare Function PrinterProperties Lib [Ô]winspool.drv[Ô] (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
Public Declare Function GetProfileString Lib [Ô]kernel32[Ô] Alias [Ô]GetProfileStringA[Ô] (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Public Declare Function OpenPrinter& Lib [Ô]winspool.drv[Ô] Alias [Ô]OpenPrinterA[Ô] (ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long)
Public Declare Function StartDocPrinter& Lib [Ô]winspool.drv[Ô] Alias [Ô]StartDocPrinterA[Ô] (ByVal hPrinter As Long, ByVal level As Long, pDocInfo As DOC_INFO_1)
Public Declare Function StartPagePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function WritePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long)
Public Declare Function EndDocPrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function EndPagePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Public Declare Function ClosePrinter& Lib [Ô]winspool.drv[Ô] (ByVal hPrinter As Long)
Para imprimir procedo desta forma:
docinfo.pDocName = [Ô]Imprimindo extrato...[Ô]
docinfo.pOutputFile = vbNullString
docinfo.pDatatype = vbNullString
jobid = StartDocPrinter(hPrinter, 1, docinfo)
Call StartPagePrinter(hPrinter)
printdata$ = StrResumo
Call WritePrinter(hPrinter, ByVal printdata$, Len(printdata$), written)
Call EndPagePrinter(hPrinter)
Call EndDocPrinter(hPrinter)
Call ClosePrinter(hPrinter)
amigo essa impressora está instalada no terminal ou na sua maquina?
se estiver na sua maquina você tem que adiciona la no terminal.
se estiver na sua maquina você tem que adiciona la no terminal.
A impressora está adicionada apenas na estação. Não há necessidade de adiciona-la no servidor, até mesmo porque utilizando outro método de impressão (active-reporter), a impressão é realizada sem problema algum.
Tópico encerrado , respostas não são mais permitidas