Computing.Net > Forums > Programming > Printing Line directly to printer -VB6

Printing Line directly to printer -VB6

Reply to Message Icon

Original Message
Name: Saif Ullah
Date: June 28, 2002 at 10:18:12 Pacific
Subject: Printing Line directly to printer -VB6
Comment:

Hi
I seek help in finding the solution of print to LPT1 directly by bypassing
the print spooler. Since my requirment is to print a line instantly on the
dot matrix printer. The problem comes when print spooler takes the job. It
feeds the paper out of the printer when the print job (one line at a time)
is completed.
I have tried many known options but failed. I need the soltion of it badly.

Saif Ullah



Report Offensive Message For Removal


Response Number 1
Name: Jim
Date: June 28, 2002 at 10:50:15 Pacific
Reply: (edit)

You should be able to open the lpt1 device with a file open() call, and do write() calls to put out the data. My dot matrix printer would print a line every time it got the CR NL sequence.

You might have a problem with your operating system. I used DOS. Sometimes Windows second-guesses you and tries to do what it thinks you want it to do instead of what you tell it to do.


Report Offensive Follow Up For Removal

Response Number 2
Name: SAif Ullah
Date: June 28, 2002 at 11:05:03 Pacific
Reply: (edit)


You are right
But by printing to LPT1, how one can format the text?
Saif


Report Offensive Follow Up For Removal

Response Number 3
Name: Jim
Date: June 28, 2002 at 12:31:32 Pacific
Reply: (edit)

> But by printing to LPT1, how one can format the text?

This is usually done with printer escape codes. Two ways of doing this come to mind. First, if the formatting you want to do is not complex, you could figure out the escape codes to do the formatting you require, and write them to the device. Printer manuals used to come with listings of the escape codes. More recently you might have to look them up on the internet or reverse engineer them from files printed using the driver.

The second way would be to build your own print spooler. Write your jobs to files instead of to the spooler. Then have your own program open the files, write the data to the printer, and leave out the page eject escape codes.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Printing Line directly to printer -VB6

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge