edutraini Posted August 7, 2014 Report Share Posted August 7, 2014 Pessoal tenho uma função que imprime etiqueta na impressora DATAMAX M-CLASS MARQ conforme abaixo. Funciona perfeitamente somente na maquina aonde esta a impressora. Gostaria de saber como faço a selecionar a impressora no Windows e Imprimir a Etiqueta pois o cliente gostaria que todas as maquinas possam ter a opcao de Impressão Static function Etiq_Iguafer() local oPrn, oFont, oPen, oFont1 Local nLinI, nColI, nLinF, nColF PRINT oPrn NAME "Impresión en Vertical.." preview DEFINE FONT oFont2 NAME "Arial" SIZE 0, -09 BOLD OF oPrn DEFINE FONT oFont NAME "Arial" SIZE 0, -06 BOLD OF oPrn DEFINE FONT oFont1 NAME "Arial" SIZE 0, -05 BOLD OF oPrn DEFINE PEN oPen WIDTH 3 OF oPrn oPrn:SetPage(9) // A4 * oPrn:SetPortrait() //Vertical oPrn:SetLandscape() // HORIZONTAL v_via = 1 _Buffer := "" _Buffer += "^XA" _Buffer += "^PR6" _Buffer += "^LH40,10^FS" Sele pedi go top Do While nropedido = vn_ped .and. .not. eof() if marcanf= .f. skip loop Endif if nroetiq = 0 skip loop Endif vn_vez = 1 vn_os = "" vn_pc = "" do while vn_vez <= nroetiq * VN_CLIENTE = SUBS(PED->NOMECLI,1,22) VN_CLIENTE = " " VN_MAT = forma+" "+tipo VN_PC = ped->pedcli vn_os = "" If !empty(pedi->coditem) vn_os = vn_os + alltrim(pedi->coditem)+"/" Endif If !empty(pedi->peditem) vn_os = vn_os + alltrim(pedi->peditem)+"/" Endif If !empty(pedi->pedite) vn_os = vn_os + alltrim(pedi->pedite) ENDIF * IF DIMENSAO3 = 0 VN_DIM = STR(DIMENSAO1,7,2)+" X "+STR(DIMENSAO2,7,2)+" "+SPAC(7) ELSE VN_DIM = STR(DIMENSAO1,7,2)+" X "+STR(DIMENSAO2,7,2)+" X "+STR(DIMENSAO3,7,2) ENDIF vn_PI = str(vn_ped,7)+" - "+str(pedi->itemcota,2)+"/"+str(vn_itped,2) if v_via = 1 PAGE nLinI := 0.80 // margem principal nColI := 0.40 nLinF := 03.6 nColF := 03.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 0.80 //CL nColI := 1.00 nLinF := 1.20 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 1.20 //PI nColI := 1.00 nLinF := 1.60 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 1.60 // MAT nColI := 1.00 nLinF := 2.20 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 2.20 //PC nColI := 1.00 nLinF := 2.60 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 2.60 // OS nColI := 1.00 nLinF := 3.00 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 3.00 // IGUAFER nColI := 1.00 nLinF := 3.60 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) oPrn:cmSay( 0.9, 0.9, " " ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 0.9, 2.2, VN_CLIENTE ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 1.3, 0.9, "PI" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 1.3, 1.8, VN_PI ,oFont,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 1.7, 0.9, "MAT" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 1.7, 2.2, VN_MAT ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 1.9, 2.3, VN_DIM ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 2.3, 0.9, "PC" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 2.3, 2.6, VN_PC ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 2.7, 0.9, "OS" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 2.7, 2.2, VN_OS ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 3.2, 2.8, "IGUAFER",oFont2,,CLR_BLACK,,PAD_RIGHT ) v_via = 2 Else nLinI := 4.10 // margem principal nColI := 0.40 nLinF := 06.9 nColF := 03.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 4.10 //CL nColI := 1.00 nLinF := 4.50 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 4.50 //PI nColI := 1.00 nLinF := 4.90 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 4.90 // MAT nColI := 1.00 nLinF := 5.50 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 5.50 //PC nColI := 1.00 nLinF := 5.90 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 5.90 // OS nColI := 1.00 nLinF := 6.30 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) nLinI := 6.30 // IGUAFER nColI := 1.00 nLinF := 6.90 nColF := 3.5 oPrn:Cmtr2Pix(@nLinI, @nColI) oPrn:cmtr2Pix(@nLinF, @nColF) oPrn:Box(nLinI, nColI, nLinF, nColF, oPen ) oPrn:cmSay( 4.2, 0.9, " " ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 4.2, 2.2, VN_CLIENTE ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 4.6, 0.9, "PI" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 4.6, 1.8, VN_PI ,oFont,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 5.0, 0.9, "MAT" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 5.0, 2.2, VN_MAT ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 5.2, 2.3, VN_DIM ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 5.6, 0.9, "PC" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 5.6, 2.6, VN_PC ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 6.0, 0.9, "OS" ,oFont,,CLR_BLACK,,PAD_RIGHT ) oPrn:cmSay( 6.0, 2.2, VN_OS ,oFont1,,CLR_BLACK,,PAD_CENTER) oPrn:cmSay( 6.5, 2.8, "IGUAFER",oFont2,,CLR_BLACK,,PAD_RIGHT ) v_via = 1 ENDPAGE Endif vn_vez = vn_vez + 1 Enddo skip Enddo IF V_VIA = 2 ENDPAGE eNDIF ENDPRINT return nil Quote Link to comment Share on other sites More sharing options...
Theotokos Posted August 7, 2014 Report Share Posted August 7, 2014 Se entendi! basta você compartilhar a impressora na rede, e assim add nas maquinas terminal... depois na impressão da etiqueta vc chama a rotina para selecionar a impressora.. GetDefaultPrinter() seleciona a impr padraoPrivate aPrn := GetPrinters( ,.t.) // Detecta impressoras instaladas e guarda num vetor * Impressora := alltrim( aPrn[1] ) // aqui tu escolhe a impressora que vai imprimir *. Quote Link to comment Share on other sites More sharing options...
Frazato Posted August 8, 2014 Report Share Posted August 8, 2014 Bom dia! tenho um processo igual ao que vc esta tentando montar mais não compartilho a impressora, fiz um programa que roda como serviço na maquina em que está instalado a impressora fisica que fica monitorando um pasta onde estão os arquivos txt pronto e simplesmente copio para impressora, no meu caso tenho impressora diferentes em portas diferentes ai direciono de acordo com o formato e o tipo de saída. Fiz usando o xharbour 99.7 e gtwvw. Obs : Coloque a o servidor como serviço para evitar que o usuário feche o programa e no caso de rede o serviço não enxerga compartilhamento ou seja você terá que copiar o arquivo na maquina servidor ( sofri muito até descobrir..rs) Frazato Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.