Recent

Author Topic: [SOLVED] impossible to cut paper in POS Printer via com Port  (Read 3265 times)

essam eddine adib

  • New Member
  • *
  • Posts: 20
[SOLVED] impossible to cut paper in POS Printer via com Port
« on: November 09, 2019, 10:31:20 pm »
hi,

i want to cut paper in POS Printer via com port but it doesn't .

when i send data to com it print but when i send command to cut it doesn't work

i use this commande

procedure TFiche.CutPaper(XCom:String);
var Lst : System.Text;
  Command:string;
  tt: string;
begin
// Serial.st;
 try
  AssignFile(Lst,XCom);// the name of printer port, can be a network share
  Rewrite(Lst);

/////  i try all thoses commands one by one

  Command :=Chr(29)+Chr(86)+CHR(1) ;
  write(Lst,Command);

  Command :=Chr(29)+Chr(86)+CHR(0) ;
  write(Lst,Command);

  Command :=Chr(29)+Chr(86)+CHR(66)+Chr(1) ;
  write(Lst,Command);

  Command :=Chr(29)+Chr(86)+CHR(98)+Chr(1) ;
  write(Lst,Command);

  Command :=Chr(29)+Chr(86)+CHR(104)+Chr(1) ;
  write(Lst,Command);

  Command :=Chr(29)+Chr(86)+CHR(48) ;
  write(Lst,Command);


  CloseFile(Lst);

 except
 end;
end;


Can you help me

thank's
« Last Edit: November 13, 2019, 02:30:32 pm by essam eddine adib »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: impossible to cut paper in POS Printer via com Port
« Reply #1 on: November 09, 2019, 10:54:31 pm »
Hi!

Before every new command send a "reset printer command" because it might get confused by the last command.

Winni

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: impossible to cut paper in POS Printer via com Port
« Reply #2 on: November 09, 2019, 11:07:05 pm »
There is  a 128 byte buffer in the IO stream, or that's what Delphi/TP has..

Using Flush(Handle) should force it to be sent.

Also, are you sure the Char(29) shouldn't be Char(27) instead ?

On top of that, I believe there is always a common ending to the string like a CR LF etc. I don't see you using WRITELN for this.

Most printers require a start and end frame byte.

The only true wisdom is knowing you know nothing

essam eddine adib

  • New Member
  • *
  • Posts: 20
Re: impossible to cut paper in POS Printer via com Port
« Reply #3 on: November 09, 2019, 11:09:14 pm »
thank's for your replay

first : how can i reset printer command

second when i startup the program and set cut paper it not work i think there is no confusing command

than'k for all

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: impossible to cut paper in POS Printer via com Port
« Reply #4 on: November 09, 2019, 11:09:37 pm »
Yeah, but the close would also flush it.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: impossible to cut paper in POS Printer via com Port
« Reply #5 on: November 09, 2019, 11:15:43 pm »
Would like to see the documentation of the command strings...


Also, it's possible to have a incorrect port setting and still have some of it working, a few chars may not work correctly and if this is the case, your command strings may not work too if they have the correct chars that get changed .
« Last Edit: November 09, 2019, 11:17:27 pm by jamie »
The only true wisdom is knowing you know nothing

essam eddine adib

  • New Member
  • *
  • Posts: 20
Re: impossible to cut paper in POS Printer via com Port
« Reply #6 on: November 09, 2019, 11:16:44 pm »
Hi,

This what i saw in ESC/POS®  Mode Command Specifications



Code: Text  [Select][+][-]
  1. GS V m
  2. Name Cut paper
  3. Code ASCII GS V m
  4. Hex. :                1D 56 m
  5. Decimal             29 86 m
  6. Defined Region m = 0,1,48,49
  7. Function Executes specified paper cut.
  8.  
  9.  

when i send data i send this command  write(file,Chr(27)+chr(74)+chr(1)+'Test') Without  CR LF

how can I add it to my command

thank u for all

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: impossible to cut paper in POS Printer via com Port
« Reply #7 on: November 09, 2019, 11:19:01 pm »
Use WRITELN instead or attached a Char(13) in the end,,.


I noticed the "m". that looks like a compound string that needs to be added to the end of all of them.

The compound string "m" has a char(0) in it. wouldn't that act as a null terminator ?

Try this for a string

 MyString := Char(29)+Char(86)+Char(0)+Char(1)+Char(48)+Char(49);
« Last Edit: November 09, 2019, 11:26:13 pm by jamie »
The only true wisdom is knowing you know nothing

essam eddine adib

  • New Member
  • *
  • Posts: 20
Re: impossible to cut paper in POS Printer via com Port
« Reply #8 on: November 09, 2019, 11:38:11 pm »
hi jamie,

in documentation they said we must choose one of  0,1,48,49

Code: Text  [Select][+][-]
  1. m Function
  2. 0, 48 Full cut
  3. 1, 49 Partial cut (one point uncut)
  4.  

the documentation is here
http://www.starmicronics.com/support/mannualfolder/escpos_cm_en.pdf


jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: impossible to cut paper in POS Printer via com Port
« Reply #9 on: November 10, 2019, 12:45:30 am »
If I understand this correctly,,,,

 If you want a full cut you use 0 or 48

a partial cut  1 or 49

 a single printer does not support both so only one group will work

 also you need to be in STANDARD mode with the paper at the start or at the top of the next page with all data printed.

 refer to ESC i and ESC m
 basically, it looks like you can't just snip the paper at any location or time.
The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: impossible to cut paper in POS Printer via com Port
« Reply #10 on: November 10, 2019, 01:14:07 am »
Hi!

To make it clear:


 MyString := Chr(29)+Chr(86)+
                                                  Chr(0) or
                                                  Chr(1)  or
                                                  Chr(48) or
                                                  Chr(49);

And you can't cut the paper at any position -
you have to move it first in "cutting position".

That you have to do with:

65
 Feeds paper to (cutting position + [n x basic calculated pitch]) and performs a full cut
66
Feeds paper to (cutting position + [n x basic calculated pitch]) and performs a partial cut (one point uncut)

So:
MyString := Chr(29)+Chr(86)+Chr(65)    or
MyString  := Chr(29)+Chr(86)+Chr(66)
           

Here we are back to the 80s and matrix printers.
And endless paper ...

Winni

essam eddine adib

  • New Member
  • *
  • Posts: 20
[SOLVED] Re: impossible to cut paper in POS Printer via com Port
« Reply #11 on: November 13, 2019, 06:55:25 am »
hi, and thank's for all and specially to jamie i used writeln and it works


« Last Edit: November 13, 2019, 02:30:18 pm by essam eddine adib »

 

TinyPortal © 2005-2018