Note that there are some explanatory texts on larger screens.

plurals
  1. POCorrect way to send commands directly to printer!
    primarykey
    data
    text
    <p>Ok, here is how i do it:</p> <pre><code>procedure TMainWindow.btnRawPrintClick(Sender: TObject); begin BeginPrint; SendStr(#27#69); SendStr('MyData'); SendStr(#10); EndPrint; end; procedure TMainWindow.SendStr(Text: String); var i: Integer; data : Array of Char; begin for i := 1 to Length(Text) do begin SetLength(data,i); data[Pred(i)] := Text[i]; end; if (PrintRawData(printHandle, data, Length(data)) &lt; 0) then begin ShowMessage('PrintRawData Failed'); EndRawPrintPage(printHandle); EndRawPrintJob(printHandle); exit; end; end; procedure TMainWindow.BeginPrint; begin printHandle := StartRawPrintJob('EPSON TM-T70 Receipt','ESDPRT001','Test Document'); if printHandle &lt; 0 then begin ShowMessage('StartRawPrintJob Failed!'); exit; end; if (StartRawPrintPage(printHandle) &lt; 0) then begin ShowMessage('StartRawPrintPage Failed!'); EndRawPrintJob(printHandle); exit; end; end; procedure TMainWindow.EndPrint; begin if (EndRawPrintPage(printHandle) &lt; 0) then begin ShowMessage('EndRawPrintPage Failed'); EndRawPrintJob(printHandle); exit; end; if (EndRawPrintJob(printHandle) &lt; 0) then begin ShowMessage('EndRawPrintJob Failed'); exit; end; end; </code></pre> <p>Also i changed a little code that i took from <a href="http://groups.google.com/group/borland.public.delphi.winapi/browse_thread/thread/25e49276f24a7ffa/a7d768caffd3ec31?q=PrintRaw%20Hecht#a7d768caffd3ec31" rel="nofollow">here</a>:</p> <pre><code>function PrintRawData(hPrn : THandle; Buffer : pointer; NumBytes : SpoolInt) : integer; {$IFDEF WIN32} var BytesWritten : DWORD; {$ENDIF} begin NumBytes := NumBytes * 2; //&lt;-- I added this line ... </code></pre> <p>However, something is wrong as some commands (escape sequences) don't work as expected!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload