Link to home
Create AccountLog in
Avatar of wimmeyvaert
wimmeyvaert

asked on

Sending content of a textfile to a LabelPrinter using TNMFTPComponent ...

Hi all,

I have a thermal Labelprinter (Intermec EasyCode 3400).
I have a textfile on my disk with following content :
<STX><ESC>C<ETX><STX><ESC>E6<CAN><ETX>
<STX><ESC>F01<NUL>1310125<ETX>
<STX><ESC>F06<NUL>Here comes some text<ETX>
<STX><ESC>F48<NUL>27/02/2007 08:38:46<ETX>
<STX><ESC>F11<NUL>Her comes a number<ETX>
<STX><RS>1<ETB><ETX>
<STX><ESC>C<ETX>

When I go to the command prompt of Windows (XP) and I type 'ftp <ipaddress_of_printer>, and I also give username and password, I am connected to the printer.
When I then use command 'put D:\Label.txt', the label is correctly printed.
So I can print data on the printer using FTP.

So, logically I want to do the same from within Delphi using the TNMFTP-Component.
Only problem is that I can't get it to work.
I tried the SendFile-Method but no success.
I tried the DoCommand, but no success.

Is there anyone who did something like this before, and can help me out on this one ?

Btw, I'm using Delphi 5 Enterprise Edition on Windows XP platform.

Thanks in advance for you help.

Wim.
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
After you get them installed, drop an idFTP control and a TButton on your form
and set the host to the IP address of the printer, the username and password
and then add this button's click event:

procedure TForm1.Button1Click(Sender: TObject);
begin
  idFTP1.Connect;
  if idFTP1.Connected then
  begin
    idFTP1.Put('D:\Label.txt');    
  end;
  idFTP1.Disconnect;
end;
Avatar of wimmeyvaert
wimmeyvaert

ASKER

Hi EddieShipman,

I'm not at work anymore (where I need this solution), and I can't reproduce the problem from home, but I will try to download/install the Indy-components and then leave a message here.

Thanks so far.

Best regards,
Good, just post the results here. I don't have an Itermec printer here, either so you will have
to be the QA...
Hi Ediie Shipman.

Your provided solution works like a charm !
Only disadvantage is that my executable grows with > 200 K after implementing the TidFTP-Component !!!
But in my case, that is not a big problem.
Thanks again for your help.

Best regards,

Wim.