Board index » delphi » How to send ESC commands to printer

How to send ESC commands to printer

Quote
> How can I send ESC commands to my printer in Borland Pascal?

  writeln (Lst,#27#69)  { reset for HP LaserPrinter }
 

Re:How to send ESC commands to printer


How can I send ESC commands to my printer in Borland Pascal?

Re:How to send ESC commands to printer


In article <MPG.11254be8c32ffe1a989...@news.primenet.com>,
Quote
Mike Copeland <mrc...@primenet.com> wrote:

:> How can I send ESC commands to my printer in Borland Pascal?
:  writeln (Lst,#27#69)  { reset for HP LaserPrinter }

Yes. A small detail. Perhaps rather use just write. The CR is
superfluous.

   All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.
Advice on spam foiling at http://www.uwasa.fi/~ts/info/spamfoil.html

Re:How to send ESC commands to printer


Quote
Timo Salmi wrote:
> In article <MPG.11254be8c32ffe1a989...@news.primenet.com>,
> Mike Copeland <mrc...@primenet.com> wrote:
> :> How can I send ESC commands to my printer in Borland Pascal?
> :  writeln (Lst,#27#69)  { reset for HP LaserPrinter }

> Yes. A small detail. Perhaps rather use just write. The CR is
> superfluous.

The writeln() ought to send CRLF, won't it?  Either way, it *could* make a
difference -- it will add an extra line that you probably don't intend to be
there.

Another minor problem that comes to mind.  As a default, opening a file
creates a default I/O buffer of 128 bytes.  This won't be sent to the file
until a.) the file is closed and committed, b.) enough data is sent to the
buffer to fill it and send to the device, or c.) code is added to force a
flush and gets executed.  (And looking at the source for the Printer unit,
it's not fixed to be unbuffered.)

Quote
>    All the best, Timo

> ....................................................................
> Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
> Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
> Department of Accounting and Business Finance  ; University of Vaasa
> mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

> Spam foiling in effect.  My email filter autoresponder will return a
> required email password to users not yet in the privileges database.
> Advice on spam foiling at http://www.uwasa.fi/~ts/info/spamfoil.html

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:How to send ESC commands to printer


In article <MPG.11254be8c32ffe1a989...@news.primenet.com>,

Quote
Mike Copeland <mrc...@primenet.com> wrote:
>> How can I send ESC commands to my printer in Borland Pascal?

>  writeln (Lst,#27#69)  { reset for HP LaserPrinter }

No no no. Do not use Writeln to send esc commands, use Write. The
above command causes the printing to start one line too low on the
paper. Also it is much readable if one writes:

Write(lst,#27'E');

Osmo

Re:How to send ESC commands to printer


In article <79grk7$...@kruuna.Helsinki.FI>,
  ronka...@cc.helsinki.fi (Osmo Ronkanen) wrote:

Quote
> In article <MPG.11254be8c32ffe1a989...@news.primenet.com>,
> Mike Copeland <mrc...@primenet.com> wrote:
> >> How can I send ESC commands to my printer in Borland Pascal?

> >  writeln (Lst,#27#69)  { reset for HP LaserPrinter }

> No no no. Do not use Writeln to send esc commands, use Write. The
> above command causes the printing to start one line too low on the
> paper. Also it is much readable if one writes:

> Write(lst,#27'E');

Actually both are totally meaningless!

Why not create a unit with just printercommands for each particular printer,
as in:

unit escseq;

interface

const
  hp_reset = #27'E';
  hp_...
  hp_...

etc

implementation;
end.

and use write(lst, hp_reset);

Robert
--
Robert AH Prins
prin...@williscorroon.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Re:How to send ESC commands to printer


Quote
In article <79g1r1$nd...@news07.btx.dtag.de> Andreas.Pasch...@t-online.de wrote...
> How can I send ESC commands to my printer in Borland Pascal?

Try running this program to see what happens;

   program FinePrint;
   uses Printer;
   begin
      write (Lst, #15);
      writeln (Lst, 'This will (probably) be in condensed print!');
   end.

Mike{*word*106}son, Black Cat Software Factory, Edinburgh, Scotland
fax 0131-271-1551 - Columnated Ruins Domino - Mellotron M400 #996

Re:How to send ESC commands to printer


In article <79hj5l$un...@nnrp1.dejanews.com>,
Robert AH Prins  <prin...@williscorroon.com> wrote:

Quote
>In article <79grk7$...@kruuna.Helsinki.FI>,
>  ronka...@cc.helsinki.fi (Osmo Ronkanen) wrote:
>> In article <MPG.11254be8c32ffe1a989...@news.primenet.com>,
>> Mike Copeland <mrc...@primenet.com> wrote:
>> >> How can I send ESC commands to my printer in Borland Pascal?

>> >  writeln (Lst,#27#69)  { reset for HP LaserPrinter }

>> No no no. Do not use Writeln to send esc commands, use Write. The
>> above command causes the printing to start one line too low on the
>> paper. Also it is much readable if one writes:

>> Write(lst,#27'E');

>Actually both are totally meaningless!

So is the above sentence unless you know English. Similarly if you know
PCL, esc'E' is not meaningless.

Osmo

Re:How to send ESC commands to printer


In article <36BBF053.9628B57B@_ix.netcom.com>,
Scott Earnest  <setech@_ix.netcom.com> wrote:

Quote

>Another minor problem that comes to mind.  As a default, opening a file
>creates a default I/O buffer of 128 bytes.  This won't be sent to the file
>until a.) the file is closed and committed, b.) enough data is sent to the
>buffer to fill it and send to the device, or c.) code is added to force a
>flush and gets executed.  (And looking at the source for the Printer unit,
>it's not fixed to be unbuffered.)

As it is a character device this does not happen.  Sometimes it is best
not to think too much.

Osmo

Re:How to send ESC commands to printer


Quote
In article <79hj5l$un...@nnrp1.dejanews.com> prin...@williscorroon.com wrote...
> > Write(lst,#27'E');
> Actually both are totally meaningless!

'Actually' it's meaningful if you understand it. Like most things.

Mike{*word*106}son, Black Cat Software Factory, Edinburgh, Scotland
fax 0131-271-1551 - Columnated Ruins Domino - Mellotron M400 #996

Re:How to send ESC commands to printer


On 6 Feb 1999 22:12:31 +0200, ronka...@cc.helsinki.fi (Osmo Ronkanen)
wrote:

Quote
>In article <36BBF053.9628B57B@_ix.netcom.com>,
>Scott Earnest  <setech@_ix.netcom.com> wrote:

>>Another minor problem that comes to mind.  As a default, opening a file
>>creates a default I/O buffer of 128 bytes.  This won't be sent to the file
>>until a.) the file is closed and committed, b.) enough data is sent to the
>>buffer to fill it and send to the device, or c.) code is added to force a
>>flush and gets executed.  (And looking at the source for the Printer unit,
>>it's not fixed to be unbuffered.)

>As it is a character device this does not happen.  Sometimes it is best
>not to think too much.
^^^^^^^^^^^^^^^^^^

>Osmo

You should know.

Bill
------------------------------
Remove JUNK for direct reply.

Re:How to send ESC commands to printer


In article <36bcda8e.11278...@news.winshop.com.au>,

Quote
Bill Boulton <bill_boul...@junk.winshop.com.au> wrote:
>On 6 Feb 1999 22:12:31 +0200, ronka...@cc.helsinki.fi (Osmo Ronkanen)
>wrote:

>>In article <36BBF053.9628B57B@_ix.netcom.com>,
>>Scott Earnest  <setech@_ix.netcom.com> wrote:

>>>Another minor problem that comes to mind.  As a default, opening a file
>>>creates a default I/O buffer of 128 bytes.  This won't be sent to the file
>>>until a.) the file is closed and committed, b.) enough data is sent to the
>>>buffer to fill it and send to the device, or c.) code is added to force a
>>>flush and gets executed.  (And looking at the source for the Printer unit,
>>>it's not fixed to be unbuffered.)

>>As it is a character device this does not happen.  Sometimes it is best
>>not to think too much.
>^^^^^^^^^^^^^^^^^^

>>Osmo

>You should know.

Was that some kind of an insult?

Osmo

Re:How to send ESC commands to printer


Quote
Osmo Ronkanen wrote:

> In article <36BBF053.9628B57B@_ix.netcom.com>,
> Scott Earnest  <setech@_ix.netcom.com> wrote:

> >Another minor problem that comes to mind.  As a default, opening a file
> >creates a default I/O buffer of 128 bytes.  This won't be sent to the file
> >until a.) the file is closed and committed, b.) enough data is sent to the
> >buffer to fill it and send to the device, or c.) code is added to force a
> >flush and gets executed.  (And looking at the source for the Printer unit,
> >it's not fixed to be unbuffered.)

> As it is a character device this does not happen.  Sometimes it is best
> not to think too much.

Does this relate to DOS internal buffering, or to TP-internal
buffering (in the TextRec)? Doing a simple flush(lst) will
help with the second one.
Note that the printer itself might do some buffering as well.
This is not relevant for this code; however, if you send a line
to the printer (be it text, or graphics with ESC codes),
you might not see it until after the corresponding CR.

For example:

program noCR;

uses printer;

begin
 write(lst, 'This program might seem to have no effect')
end.

Of course, the data is at the printer and will eventually
be printed out.

Other Threads