Impressao DOS via rede
Olá, tentei utilizar a rotina abaixo , extraida da internet, para imprimir DOS via rede (writeln), nao funcionou , uso win2000, se alguem puder ajudar agradeço.
Imprimir em impressora matricial em modo caracter via Rede
// Esta rotina lê todas as impressoras instaladas no windows
// e coloca dentro de um ComboBox e não se esqueça de adicionar
// na cláusula uses a unit Printers
procedure TForm1.FormShow(Sender: TObject);
var I : Integer;
begin
ComboBox1.Items.Clear;
For I:= 1 to Printer.Printers.Count do
Begin
if Pos(´LPT´, printer.Printers.Strings[I-1]) > 0Then
ComboBox1.Items.Add(´LPT1´)
Else if Pos(´\´, printer.Printers.Strings[I-1]) > 0 Then
ComboBox1.Items.Add(Copy(printer.Printers.Strings[I-1],
Pos(´\´, printer.Printers.Strings[I-1]),
length(printer.Printers.Strings[I-1]) -
Pos(´\´, printer.Printers.Strings[I-1]) + 1));
End;
End;
// e quando apertar o botao imprimir, o evento pega qual a impressora
// que você escolheu atravéz do ComboBox e Imprimi.
procedure TForm1.btImprimirClick(Sender: TObject);
var I:Integer;
Arquivo : TextFile;
begin
AssignFile(Arquivo,ComboBox1.Value);
Rewrite(Arquivo);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 1´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 2´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 3´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 4´);
CloseFile(Arquivo);
end; :?:
Imprimir em impressora matricial em modo caracter via Rede
// Esta rotina lê todas as impressoras instaladas no windows
// e coloca dentro de um ComboBox e não se esqueça de adicionar
// na cláusula uses a unit Printers
procedure TForm1.FormShow(Sender: TObject);
var I : Integer;
begin
ComboBox1.Items.Clear;
For I:= 1 to Printer.Printers.Count do
Begin
if Pos(´LPT´, printer.Printers.Strings[I-1]) > 0Then
ComboBox1.Items.Add(´LPT1´)
Else if Pos(´\´, printer.Printers.Strings[I-1]) > 0 Then
ComboBox1.Items.Add(Copy(printer.Printers.Strings[I-1],
Pos(´\´, printer.Printers.Strings[I-1]),
length(printer.Printers.Strings[I-1]) -
Pos(´\´, printer.Printers.Strings[I-1]) + 1));
End;
End;
// e quando apertar o botao imprimir, o evento pega qual a impressora
// que você escolheu atravéz do ComboBox e Imprimi.
procedure TForm1.btImprimirClick(Sender: TObject);
var I:Integer;
Arquivo : TextFile;
begin
AssignFile(Arquivo,ComboBox1.Value);
Rewrite(Arquivo);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 1´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 2´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 3´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 4´);
CloseFile(Arquivo);
end; :?:
Robertorb
Curtidas 0
Respostas
Salomao
24/07/2003
salomaosoares@bol.com.br
mande-me um e-mail que ajudarei!
mande-me um e-mail que ajudarei!
GOSTEI 0
Eduardo.sic
24/07/2003
tb tive esse Problema.. o w2000 NT4 e Xp não imprimem direto na porta...
voce pode mandar a impressão para a impressora na rede assim...
procedure TForm1.FormShow(Sender: TObject);
var I : Integer;
begin
// Carrega as impressoras num ComboBox
ComboBox1.Items.Clear;
For I:= 1 to Printer.Printers.Count do Begin
ComboBox1.Items.Add(Copy(printer.Printers.Strings[I-1], Pos(´\´, printer.Printers.Strings[I-1]), length(printer.Printers.Strings[I-1]) - Pos(´\´, printer.Printers.Strings[I-1]) + 1));
End;
end;
procedure TForm1.btImprimirClick(Sender: TObject);
var
I:Integer;
Arquivo : TextFile;
Nm_Arquivo:String;
begin
Nm_Arquivo := ´C:\Teste.txt´;
AssignFile(Arquivo,Nm_Arquivo);
Rewrite(Arquivo);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 1´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 2´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 3´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 4´);
CloseFile(Arquivo);
CopyFile( Arquivo, ComboBox1.Text, false); // ou fileCopy não lembro... olha o help
// seria como CopyFile( Arquivo, ´\\Servidor-01\Epson´, false); OK!!!
end;
voce pode mandar a impressão para a impressora na rede assim...
procedure TForm1.FormShow(Sender: TObject);
var I : Integer;
begin
// Carrega as impressoras num ComboBox
ComboBox1.Items.Clear;
For I:= 1 to Printer.Printers.Count do Begin
ComboBox1.Items.Add(Copy(printer.Printers.Strings[I-1], Pos(´\´, printer.Printers.Strings[I-1]), length(printer.Printers.Strings[I-1]) - Pos(´\´, printer.Printers.Strings[I-1]) + 1));
End;
end;
procedure TForm1.btImprimirClick(Sender: TObject);
var
I:Integer;
Arquivo : TextFile;
Nm_Arquivo:String;
begin
Nm_Arquivo := ´C:\Teste.txt´;
AssignFile(Arquivo,Nm_Arquivo);
Rewrite(Arquivo);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 1´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 2´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 3´);
WriteLn(Arquivo, ´TESTE DE IMPRESSAO - 4´);
CloseFile(Arquivo);
CopyFile( Arquivo, ComboBox1.Text, false); // ou fileCopy não lembro... olha o help
// seria como CopyFile( Arquivo, ´\\Servidor-01\Epson´, false); OK!!!
end;
GOSTEI 0