Delphi controls POS printers

Source: Internet
Author: User
Delphi controls POS printers

Rprinter is textfile type;
Scontent is tstringlist type.

// Create a print connection and print data
Assignfile (rprinter, 'lpt1'); // sets the printer
Rewrite (rprinter); // prepare to write the file
Writeln (rprinter, CHR ($ B) + CHR (27) + 'K' + CHR (40); // pour the paper backwards!
...

For I: = 0 to scontent. Count-1 do
Writeln (rprinter, scontent. Strings [I]);

Writeln (rprinter, CHR ($ B) + CHR (27) + 'J' + CHR (140); // Forward Feed

Closefile (rprinter); // close the printer and stop printing
Scontent. Free; // release the string list

Assignfile (rprinter, 'lpt1'); // sets the printer
Rewrite (rprinter); // prepare to write the file
Writeln (rprinter, CHR (27) + 'P' + 'M' + (the next two look like parameters) T1 T2); // Open the cash box
Closefile (rprinter); // close the printer and stop printing

 

Cash Box Control Command (this command can enable two cash boxes at the same time, the actual operation only needs to enable one)
1. The pK mode drives the cash box command
ESC | r F9 M N1 N2
M = 0 represents a cash box n represents the pulse width n1 = 40--50
M = 1 represents two cash box n2 = 120--150
Programming in QBASIC
Lprint CHR $ (27); "|"; "R"; CHR $ (249); CHR $ (0); CHR $ (50); CHR $ (150)
2. Pos mode drives cash box commands
Esc r p m N1 N2
M = 0 represents a cash box n represents the pulse width n1 = 40--50
M = 1 represents two cash box n2 = 120--150
Programming lprint CHR in QBASIC $ (27); CHR $ (112); CHR $ (0); CHR $ (50); CHR $ (200)
3. bs300k can open two cash boxes at the same time. When receiving 2 or 4, the cash box 1 is opened, and when receiving 4 or 5, the money box 2 is opened.
4. Set the automatic cash box feature in Windows
Lprint CHR $ (27); "| W"; CHR $ (45); CHR $ (N );
N = 0 FF when taking the paper command, the cash box is invalid.
N = 1 cash box 1 open
N = 2 Cash Box 2 open

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.