Sending data to a printer (QBASIC) 
Author Message
 Sending data to a printer (QBASIC)

When I try to send data to the printer from QBasic, it all gets printed
together. How do I start from a new page each time? Please help

This is what I do:

CONST FILENAME$ = "LPT1:"
CONST FIL = 35

DO
.......do some stuff.......
OPEN FILENAME$ FOR OUTPUT AS #FIL
...
PRINT #FIL, somedata$
...
CLOSE #FIL
...
LOOP
END



Fri, 17 Oct 2003 07:31:48 GMT  
 Sending data to a printer (QBASIC)

Quote:
> When I try to send data to the printer from QBasic, it all gets printed
> together. How do I start from a new page each time? Please help

You need to print a form feed (x'0B' or CHR$(12)) to force the printer to
advance one page.

MCM



Fri, 17 Oct 2003 08:00:28 GMT  
 Sending data to a printer (QBASIC)

Quote:



>> When I try to send data to the printer from QBasic, it all gets printed
>> together. How do I start from a new page each time? Please help
> You need to print a form feed (x'0B' or CHR$(12)) to force the printer to
> advance one page.

ITYM x'0C'.

Also, that can be quite printer-specific although that aspect isn't as
bad as it was, say, 15 years ago.



Sat, 18 Oct 2003 00:36:20 GMT  
 Sending data to a printer (QBASIC)

Hello WhiteHorse,

Quote:
> When I try to send data to the printer from QBasic, it all gets printed
> together. How do I start from a new page each time? Please help

Try terminating each print-job with a Form-feed character.  The command would be:

  print #FIL,chr$(12);

(Don't forget the ";" ! )

By the way: did you know that you can use the command LPRINT ?  Not File-opening & Closing needed when you do ....

   LPRINT "-- some text to my printer --"
   LPRINT chr$(12);

Regards,
  Rudy Wieser



Sat, 18 Oct 2003 15:01:46 GMT  
 Sending data to a printer (QBASIC)
Thanks a lot! I didn't know that.



Quote:

> Hello WhiteHorse,

> > When I try to send data to the printer from QBasic, it all gets printed
> > together. How do I start from a new page each time? Please help

> Try terminating each print-job with a Form-feed character.  The command
would be:

>   print #FIL,chr$(12);

> (Don't forget the ";" ! )

> By the way: did you know that you can use the command LPRINT ?  Not

File-opening & Closing needed when you do ....
Quote:

>    LPRINT "-- some text to my printer --"
>    LPRINT chr$(12);

> Regards,
>   Rudy Wieser



Sat, 18 Oct 2003 21:28:09 GMT  
 Sending data to a printer (QBASIC)



Quote:

> Hello WhiteHorse,

> > When I try to send data to the printer from QBasic, it all gets printed
> > together. How do I start from a new page each time? Please help

> Try terminating each print-job with a Form-feed character.  The command
would be:

>   print #FIL,chr$(12);

> (Don't forget the ";" ! )

> By the way: did you know that you can use the command LPRINT ?  Not

File-opening & Closing needed when you do ....

Quote:

>    LPRINT "-- some text to my printer --"
>    LPRINT chr$(12);

Hmm...  that's fair enough with directly connected printers.  However
network printers normally work better when you use file-opening and closing.

Cheers

Derek



Sun, 19 Oct 2003 05:28:42 GMT  
 Sending data to a printer (QBASIC)

Hello Derek

[Snip]

Quote:
> > By the way: did you know that you can use the command LPRINT ?  Not
> File-opening & Closing needed when you do ....

> >    LPRINT "-- some text to my printer --"
> >    LPRINT chr$(12);

> Hmm...  that's fair enough with directly connected printers.  However
> network printers normally work better when you use file-opening and closing.

I can imagine you're right.  I would never have thought about it (printing in QBasic to a Network-printer).  

But if it goes to a Network-printer, should the closing of the Printer-"file" not signal an End-Of-Job, automatically ejecting the
last sheet of paper ?  Ofcourse, only if so set in the Printer-spoolers configuration ....

Regards,
  Rudy Wieser



Sun, 19 Oct 2003 14:46:55 GMT  
 Sending data to a printer (QBASIC)
LPRINT is nice to use but the problem is that the network queue doesn't know
whether to LPRINT immediately or whether to wait and see if there is going
to be another LPRINT printing on the same page.  The two normal solutions
are either to wait until 30 seconds have passed without an LPRINT and assume
that printing is finished or to wait until the QBASIC program ends at which
point there definitely won't be any more LPRINT statements.  Either way
could leave the network printer waiting unnecessarily.

Using OPEN and CLOSE statements on the other hand, signals to the printer
that the print job is finished as soon as the CLOSE statement is executed,
so printing can be completed as soon as possible.

Cheers

Derek



Quote:

> Hello Derek

> [Snip]

> > > By the way: did you know that you can use the command LPRINT ?  Not
> > File-opening & Closing needed when you do ....

> > >    LPRINT "-- some text to my printer --"
> > >    LPRINT chr$(12);

> > Hmm...  that's fair enough with directly connected printers.  However
> > network printers normally work better when you use file-opening and
closing.

> I can imagine you're right.  I would never have thought about it (printing

in QBasic to a Network-printer).
Quote:

> But if it goes to a Network-printer, should the closing of the

Printer-"file" not signal an End-Of-Job, automatically ejecting the

- Show quoted text -

Quote:
> last sheet of paper ?  Ofcourse, only if so set in the Printer-spoolers
configuration ....

> Regards,
>   Rudy Wieser



Mon, 20 Oct 2003 05:35:18 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Sending Printer Commands to Printer using QBASIC

2. Help, How to send printer command to printer bypassing printer driver in vb

3. How to send TextBox data to printer ?

4. Sending Data To The Printer

5. capturing data sent to printer

6. How to send Raw data to the printer

7. Sending raw data to the printer

8. How to send TextBox data to printer ?

9. How to send data to printer port

10. how to send RAW data to printer

11. Help with sending RAW Data to HP Laser Printer

12. Sending data to LPT1 (printer)

 

 
Powered by phpBB® Forum Software