Sending DOS Codes to Printer

D

DannyBoy

Would like to know how I can send a 'reset' code via the MS-DOS environment
to my printer:
Computer: Dell Dimension 8400
Oper System: Windows XP
Printer HP LaserJet 4L

The printer works fine for all my printing needs but I have a REALLY OLD
general ledger software program that doesn't begin printing at the top of the
next page ALL the time (it works right SOME of the time). I was thinking I
could send a DOS command to the printer to get my print jobs to print at the
top of the page.

Thanks in advance,
DannyBoy
 
D

Davide Guolo

DannyBoy said:
Would like to know how I can send a 'reset' code via the MS-DOS environment
to my printer:
...
I have a REALLY OLD
general ledger software program that doesn't begin printing at the top of the
next page ALL the time (it works right SOME of the time).

Are you sure the printer correctly loads the paper ? (does it happen
only when printing from DOS ?)

If the printer is ok, then probably the DOS program in some jobs is
printing a larger number of rows per page then the printer's supported
one. This might cause the additional rows being printed on the next page.

In this case you might solve the problem by using Printfil to capture
the source DOS job and forward it to the Windows printer in GDI mode.
Printfil allows you to specify your desired "number of rows per page"
and page margins, and optionally, even to cut a certain number of rows
at the bottom of each page in the source captured jobs. This way your
jobs should be correctly aligned to any Windows printer (or, at least,
the additional rows will not be printed on the next pages)

Kind regards,
Davide Guolo
aSwIt s.r.l.
--------------------------------------------------------------
Printfil - Windows Printing System for Applications
http://www.printfil.com
Odbc4All - Connection to ODBC Data Sources for any Application
http://www.aswit.com/odbc4all
@Kill - Batch Close Windows Applications - Freeware
http://www.aswit.com/akill
--------------------------------------------------------------
 
C

Christoph Lindemann

You could try sending the following PCL string (between the -------- lines):

-------------------
<Esc>%-12345X<Esc>E<Esc>%-12345X
-------------------
where <Esc> is replaced by ASCII 27 (hex 1B)

in plain hex this would be:
1b 25 2d 31 32 33 34 35 58 1b 45 1b 25 2d 31 32 33 34 35 58

This will reset the printer and print any partial started page.

You can make this file with <insert your favorite hex editor> and copy it to
lpt1.
 
D

DannyBoy

Mr Lindemann:

That sounds like the answer that I am looking for. Two questions:
1) you say 'favorite hex editor:' do you know where I can download one of
these? And could I use either Microsoft's Notepad or Wordpad?
2) when you say copy this file to the LPT1 is the correct format as follows?:
copy (filename) LPT1

Thanks again for the quick response,
DannyBoy
 
C

Christoph Lindemann

DannyBoy said:
1) you say 'favorite hex editor:' do you know where I can download one
of
these? And could I use either Microsoft's Notepad or Wordpad?

You can not use notepad or wordpad, as you need to include some special
command characters that are outside the normal "visible" character range:
ESC (escape) = ascii 0x1B
You can use "Source Edit" which comes with an extra hex editor.
http://www.brixoft.net/products.asp
2) when you say copy this file to the LPT1 is the correct format as
follows?:
copy (filename) LPT1

If your printer is connected to LPT1 then the command would be:

type filename > lpt1

or else please see the following page from Bruce Sanderson
http://members.shaw.ca/bsanders/printfromdos.htm
 
E

Eric P.

DannyBoy said:
Would like to know how I can send a 'reset' code via the MS-DOS environment
to my printer:
Computer: Dell Dimension 8400
Oper System: Windows XP
Printer HP LaserJet 4L

The printer works fine for all my printing needs but I have a REALLY OLD
general ledger software program that doesn't begin printing at the top of the
next page ALL the time (it works right SOME of the time). I was thinking I
could send a DOS command to the printer to get my print jobs to print at the
top of the page.

Thanks in advance,
DannyBoy
Why you call them "Dos Codes" I don't know because a HP Laserjet 4L uses
HP PCL codes to setup or change it's settings.

There are numerous little programs on Internet available that can send
codes to printer devices from the Dos prompt without needing HEX editors
and such.
You only need to know the right code sequences and those are in the HP
Laserjet 4L manual or else on the HP website or webpages like this
http://www.digitalissues.co.uk/html/software/utils/pcl_page.html

One of the many programs is my own little SEND2PRN which is a homebrewn
Dos .COM program from the time in the far distant past I did a lot of
PCL work.
It sends HEX codes to the standard parallel printer device PRN.
The program uses commands like SEND2PRN 1B,28,73,30,42 ENTER

Maybe I can also find little programs like these on my harddisk dat use
decimal iso HEX, it's a matter of preference!
You could reach me via (e-mail address removed) if you want.
 
D

DannyBoy

Thanks a gazillion! I have not yet had the time to try it but it looks like
the best answer yet to my simple problem.

Thanks again,
Dannyboy
 
E

Eric P.

DannyBoy said:
Thanks a gazillion! I have not yet had the time to try it but it looks like
the best answer yet to my simple problem.

Thanks again,
Dannyboy
I could send you SEND2PRN.COM.
Maybe also ENTERPRN.COM that only sends a newline and FFPRN.COM that
sends a formfeed if you could use them.
 
E

Eric P.

Paul said:
You guys don't like a hex editor and COPY/B?
Paul
I have been programming assembler since the early eighties.
That's why don't have any problem with HEX and could solve the problem
very easy by creating the needed files with DEBUG.

But the little program SEND2PRN made it easier when I was playing with
PCL on the first HP Deskjet printers long ago.

Later when I had bought the then very new HP Laserjet 4+ and soon after
that HP's PCL5 Printer Language Technical Reference Manual I wrote a
basic program with which I could do all exercises in the manual and more.
That included HP-GL2 and PJL.

The Laserjet was connected to the PC with a parallel cable and a serial
as well.
The commands to the printer went via the serial cable and parallel cable
was for the print output.
All just for fun.
A bit too much for COPY/B I think.
 
P

Paul Baker [MVP, Windows - SDK]

Okay :)

Paul

Eric P. said:
I have been programming assembler since the early eighties.
That's why don't have any problem with HEX and could solve the problem
very easy by creating the needed files with DEBUG.

But the little program SEND2PRN made it easier when I was playing with PCL
on the first HP Deskjet printers long ago.

Later when I had bought the then very new HP Laserjet 4+ and soon after
that HP's PCL5 Printer Language Technical Reference Manual I wrote a basic
program with which I could do all exercises in the manual and more.
That included HP-GL2 and PJL.

The Laserjet was connected to the PC with a parallel cable and a serial as
well.
The commands to the printer went via the serial cable and parallel cable
was for the print output.
All just for fun.
A bit too much for COPY/B I think.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top