QBasic Printer Woes 
Author Message
 QBasic Printer Woes

Hello,
For the longest time I just didn't use the LPRINT command in QBASIC.
Now that I have, I realize that I don't have the necessary printer
drivers that eject the page from my printer. I have an HP 4L laser
printer. Does anyone know where I might find these drivers, or some
that would work. Furthermore, am I missing a command that would do
this for me. Thanks in advance.

Weston M. Price
Bath, Maine



Mon, 11 Jan 1999 03:00:00 GMT  
 QBasic Printer Woes


Quote:
> For the longest time I just didn't use the LPRINT command in QBASIC.
> Now that I have, I realize that I don't have the necessary printer
> drivers that eject the page from my printer. I have an HP 4L laser
> printer. Does anyone know where I might find these drivers, or some
> that would work. Furthermore, am I missing a command that would do
> this for me. Thanks in advance.

Try just lprinting a \f (formfeed) to the printer.  I believe that the
ascii code for that is 12.

So, for example,

lprint chr$(12)

--
--
tIM...HOEk
Outnumbered?  Maybe.  Outspoken?  NEVER!
--



Mon, 11 Jan 1999 03:00:00 GMT  
 QBasic Printer Woes


Quote:
>Hello,
>For the longest time I just didn't use the LPRINT command in QBASIC.
>Now that I have, I realize that I don't have the necessary printer
>drivers that eject the page from my printer. I have an HP 4L laser
>printer. Does anyone know where I might find these drivers, or some
>that would work. Furthermore, am I missing a command that would do
>this for me. Thanks in advance.
>Weston M. Price
>Bath, Maine

To eject the page, or advance to a new page in the middle of a
printout, send a lone form feed character to the printer:

        FF$ = CHR$(12)  <- if memory serves correctly!

        LPRINT FF$;  <- note the semicolon!

This works just fine, and sounds like it will do what you want.

Best wishes,

-greg



Mon, 11 Jan 1999 03:00:00 GMT  
 QBasic Printer Woes



Quote:
>t!news-pen-4.sprintlink.net!news.ime.net!usenet

>Newsgroups: comp.lang.basic.misc
>Subject: QBasic Printer Woes
>Date: Thu, 25 Jul 1996 12:16:02 GMT
>Organization: Internet Maine Inc.
>Lines: 11

>NNTP-Posting-Host: bath-26.ime.net
>X-Newsreader: Forte Free Agent 1.0.82
>Hello,
>For the longest time I just didn't use the LPRINT command in QBASIC.
>Now that I have, I realize that I don't have the necessary printer
>drivers that eject the page from my printer. I have an HP 4L laser
>printer. Does anyone know where I might find these drivers, or some
>that would work. Furthermore, am I missing a command that would do
>this for me. Thanks in advance.
>Weston M. Price
>Bath, Maine

here is the code I use

esc$ = CHR$(27)
LPRINT esc$ + "E"

good way to do other things as well such as to put in landscape mode

LPRINT esc$ +"&l10"   (2nd character is lower case letter el)
Dr. Jeffrey R. Wyatt
Code 6110
Naval Research Laboratory
Washington, DC  20375
(202) 767-3244
(202) 404-8119 FAX



Tue, 12 Jan 1999 03:00:00 GMT  
 QBasic Printer Woes

Quote:



> >t!news-pen-4.sprintlink.net!news.ime.net!usenet

> >Newsgroups: comp.lang.basic.misc
> >Subject: QBasic Printer Woes
> >Date: Thu, 25 Jul 1996 12:16:02 GMT
> >Organization: Internet Maine Inc.
> >Lines: 11

> >NNTP-Posting-Host: bath-26.ime.net
> >X-Newsreader: Forte Free Agent 1.0.82

> >Hello,
> >For the longest time I just didn't use the LPRINT command in QBASIC.
> >Now that I have, I realize that I don't have the necessary printer
> >drivers that eject the page from my printer. I have an HP 4L laser
> >printer. Does anyone know where I might find these drivers, or some
> >that would work. Furthermore, am I missing a command that would do
> >this for me. Thanks in advance.

> >Weston M. Price
> >Bath, Maine

> here is the code I use

> esc$ = CHR$(27)
> LPRINT esc$ + "E"

> good way to do other things as well such as to put in landscape mode

> LPRINT esc$ +"&l10"   (2nd character is lower case letter el)
> Dr. Jeffrey R. Wyatt
> Code 6110
> Naval Research Laboratory
> Washington, DC  20375
> (202) 767-3244
> (202) 404-8119 FAX

You can use the lprint chr$(nn) sequence to make a printer do just about
anything if you have the manual for the printer.

lprint chr$(27);chr$(10);..... etc
futhermore if you want to you could make a general rt to  do it by
defining groups ending with 999

snippet:

27,10,999

keep reading till hit 999

If you use a double level array (where first index defines what) you
have a complete general purpose print driver!




Thu, 14 Jan 1999 03:00:00 GMT  
 QBasic Printer Woes

   All kind of hints have been sent with regards to printercontrol. I'd
like to state some general remarks to this subject.

   Most printers are controled by some sequence of bytes that will not be
printed but interpreted by the printer to change some settings or perform a
certain action.
   The Qbasic-system has the built-in functionality to keep track of the right
margin and sends a newline command upon reaching it. That is to say: after
having sent the number of bytes that will fit on a single line, it supposes
the right margin has been reached. Wrong! At least in the case where some
long initialization-sequence has been sent as well as a lot of fontstyle
switching commands. All bytes in these commands will be counted to detect
reaching the right margin, and hence leaving fewer characters to print on
that line.

   There's a slolution to this and that's setting the rightmargin to infinity
or shutting off the margindetection by using the WIDTH LPRINT,255 statement.
Or if the printer is accessed as a file ( OPEN "LPT1:BIN" FOR OUTPUT AS
#Printer%) use WIDTH #Printer%, 255.

   When done like this, a newline command will be sent only after completing
a line as in PRINT #Printer%, "Last words on this line"

   There's another advantage of accessing the printer as a file over LPRINT.
Output to the printer is easily redirected to a file or network
printerqueue. Simply change the device that's associated with the handle
Printer% like OPEN "DUMP.PRN" FOR OUTPUT AS #Printer% and the very same code
to actually print can be used to save output in the file DUMP.PRN.

   As to the design of a printerdriver-system that eventually can support
different printers or printerbrands, I've good experience with the following
system. When designing/programming  your printer output, use printer
commands like this:

  PRINT #Printer%, DblWidthON$;"STOCK Report";DblWidthOFF$
  PRINT #Printer%, "Printed on ";BoldON;DATE$;BoldOFF$

   Furthermore, setup a set of string-variables (in a COMMON or SHARED block)
that are initialised for the particular printer in use:

   DIM SHARED PrinterInit$, BoldON$, BoldOFF$, UnderlON$, UnderlOFF$
   DIM SHARED DblWidthON$, DblWidthOFF$, ItalicsON$, ItalicsOFF$, Reset$

   '
   'Deskjet / PCL
   ,
   Esc$ = CHR$(27)
   Reset$ = Esc$+"E"
   PrinterInit$ = Esc$+"&1o26A"+Esc$+"(10U"+Esc$"(s0P"
     'portrait, A4, PC-8 char.set, Fixed spacing
   BoldON$ = Esc$+"(s3B"
   BoldOFF$ = Esc$+"(s0B"
   FontCourier$ = Esc$+"(s3T"

  You could even create a routine that loads the actual sequences for the
specified printer from disk and sets up the commands for use with that
printer. When the user specifies to use an EPSON LX 850 instead of the
LaserJet 4, the routine simply loads the sequences from another file that
has been setup for the epson.
   I've been working on such a system, which resluted in a library of more
that 100 different drivers. Such a library offers virtually all users nice
looking printer output on ther personal printers.
   I've never programmed for windows or Visual Basic, but I'm quite curious
how printing is done under windows. How can every application make use of the
windows-printer drivers etc.

   A routine to open the printerport comes in handy. One could check printer
status etc. with ON LOCAL ERROR GOTO

   SUB InitPrinter (Printer$, Printer%)
      ON LOCAL ERROR GOTO PrinterFails
      Printer% = FREEFILE
      OPEN Printer$ FOR OUTPUT AS # Printer%
      WIDTH #Printer%, 255
      PRINT #Printer%, PrinterInit$;

      GOTO PrinterReady

    PrinterFails:
      Printer% = 0
      Resume PrinterReady

    PrinterReady:
   END SUB

  and use it like this:

   InitPrinter("LPT1:BIN", Printer%)
   IF Printer% = 0 THEN
       PRINT "Sorry user, couldn't access printer"
   ELSE
      PRINT #Printer%, ItalicsON$;"Hello World!"
      PRINT #Printer%, Reset$;
      CLOSE #Printer%
   END IF

I hope no bandwidth is waisted with this. I thought it would be usefull on
this subject. If you want to know more or details or have any questions, do

Regards,

Marnix.



Sun, 17 Jan 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sending Printer Commands to Printer using QBASIC

2. Printer Woes (Visual Basic)

3. Printer Woes

4. Printer API woes

5. Printer Woes......

6. Printer Woes

7. printer woes..

8. printer woes

9. Printer WOES

10. Printer API woes

11. Printer Woes!

12. printer output difficulty with Qbasic

 

 
Powered by phpBB® Forum Software