1

as the subject, I have a POS printer MatrixPoint MP-3250. As the manual said it is support command: ESC/POS compatible

I do search google, tried but won't works. At least setting condensed fonts, bold, italic and cutting paper command.

Running specifications:

  1. Windows 7 32bit
  2. The printer interface was Parallel slot, I use BAFO parallel to USB adapter.
  3. After the BAFO's driver installed, we got: USB001 - Virtual printer port for USB
  4. I add the printer manually in "Devices and Printers" (add local printer, set to USB001 port and using Generic / Text only printer driver.
  5. I send command using winspool APIs (WritePrinter)
  6. Delphi XE

Please help me out, any comments will appreciate.

I tried using this ESC/POS manual.

EDIT.

Here is how:

function WriteToPrinter(const Data: string): DWord;
var Temp: AnsiString;
begin
  // write directly to printer device
  { ----
    Note:
    This method is also able to send Escape command sequences directly,
    so you're no longer need to call Win32 API complicated Escape() function.
  }

  // We need convert to raw string since I'm using Delphi XE
  // string = UnicodeString

  Temp := AnsiString(Data);

  Result := 0;
  if (fPrnStatus = rpsPageStarted) then
    WritePrinter(fPrnHandle, PAnsiString(Temp), Length(Temp), Result);
end;

WriteToPrinter(#27'@'); // init printer
WriteToPrinter(#27'S'); // normal mode?
WriteToPrinter('Printing to default printer.'); // data
WriteToPrinter('GSV0'); // Cut the paper

What we got on printed paper: OWOTOFTPrinting to default printer (strange characters appear)

The paper failed to cut (notting happend)

EDIT: Mostly forgot, the above stuff working fine on Epson compatible / IBM 9068A Passbook Printer (Dot matrix). (not sure) the printer connected directly to USB / Parallel port, not using adapter (Parallel to USB like now).

I supposed something wrong in/between this adapter, or its drivers?

Thank you

stukelly
  • 4,257
  • 3
  • 37
  • 44
coderbuzz
  • 131
  • 1
  • 11
  • 2
    When you do "Print Test Page" from the windows printer settings, do you get anything? When you say "won't work", what did you try, what did you expect, what did you get in return? Can you show some code for how you use the WritePrinter API? – Cosmin Prund Mar 24 '11 at 07:15
  • @cosmin-prund Yes I get the text properly printed (print test page). OK, post updated, please take a look. Thanks – coderbuzz Mar 24 '11 at 07:34
  • Try using the [Escape](http://msdn.microsoft.com/en-us/library/dd162701(v=vs.85).aspx) function with `PASSTHROUGH`. You've got a comment in your function stating `WritePrinter` is capable of sending escape sequences to the printer without the use of Escape. But I don't see any mention of that on the MSDN page for WritePrinter, and your result suggests the escapes didn't make it through. – Cosmin Prund Mar 24 '11 at 07:55
  • Thanks for the hints, I'll cek this out. – coderbuzz Mar 24 '11 at 08:02
  • Mostly forgot, the above stuff working fine on Epson compatible / IBM 9068A Passbook Printer (Dot matrix). (not sure) the printer connected directly to USB / Parallel port, not using adapter (Parallel to USB like now). I supposed something wrong in/between this adapter, or its drivers? – coderbuzz Mar 24 '11 at 08:09
  • @coderbuzz Have a look at this answer: http://stackoverflow.com/questions/794162/checking-printer-messages-using-opos-drivers-in-delphi/794521#794521 Maybe you need to change the DataType to RAW. – stukelly Mar 24 '11 at 10:25
  • @stukelly Yes I've already do that. On somewhere at BeginDoc I have set the pDatatype := 'RAW'; Thanks BTW. – coderbuzz Mar 24 '11 at 11:56

2 Answers2

1

Your cut command is send out wrong.

The GSv0 is split into: GS (group seperator) #29 v that is the lower case 'v' 0 the binary value zero #0

This should make the cut.

Glenner003
  • 1,450
  • 10
  • 20
  • Hmmm, I'm sure the ebook say 'V' not lower case 'v', about the group separator #29 I'll check it later. So how does complete command look? WriteToPrinter('GS'#29#0); ? OK I'll try your hints. Thanks – coderbuzz Mar 24 '11 at 12:06
  • 1
    It'll rather look like this WriteToPrinter(#29'v'#0) – Glenner003 Mar 24 '11 at 14:24
  • You right, I'm wrong interpreting the command docs. GS=29. So it should be: WriteToPrinter(#29#86#0) -> where #86 = 'V' – coderbuzz Mar 29 '11 at 03:12
0

Case closed. My final suspect was right, the problem was BAFO - Parallel to USB adapter. Siggh, I spending a lot of time because of this semi working adapter (incompatible). By replacing with another type/branch adapter it is now works fine.

Thank you to all contributors

coderbuzz
  • 131
  • 1
  • 11