Make BestShareware.net your home page Add BestShareware.net to your favorites  

Homepage

Help Desk

Site Map

Popular

What's New

Featured
Search Software:
WWW         BestShareware.net
  MAC Software | Linux Software | Pocket PC | iPod Software
 Guides and Tutorial
DVD to iPod
AVI to iPod
MPEG to iPod
RM to iPod
3GP to ipod
WMV to ipod
Divx to ipod
ASF to ipod
VOB to ipod
MOV to ipod
  Software Directories
DVD & Video
MP3 & Audio
Graphics
Applications
Internet
Security & AntiVirus
Development
PC Tools
Computer Games
iPod Software


How to print from DOS to USB, GDI, Virtual and other Windows-Only printers?


Basic DOS programs cannot print to USB, GDI and Virtual Windows printers directly. This article explain you how to let them doing this through Printfil.


Introduction

This article applies to the Basic programming language and its DOS variations (GWBasic, QuickBasic, PowerBasic, etc.) covering different topics about how to correctly manage Windows printing:

1.Closing the printer port at the print job end
2.Printing to printers which are not DOS compatible, like USB GDI printers or virtual printers (fax printer drivers, PDF writers, etc.)

Basic printing

DOS Basic programs are used to print by using LPRINT statements, which directly send the specified characters to the LPT1: (only) parallel port.

In the age of DOS, typically a dot-matrix printer was connected to LPT1:, starting printing that data as soon as it was sent to the port and before all the data has been sent by the program, but on recent Windows systems this causes a common problem: How to make DOS programs printing faster in Windows? That's because LPRINT does not close the printer port at the print job end.

Fortunately, the Basic language already provides a solution for this problem. Consider this source:

10 LPRINT "Hello world"

You can obtain the same behaviour changing it as:

10 OPEN "LPT1:" FOR OUTPUT AS #1
20 PRINT #1,"Hello world"
30 CLOSE #1


with two main advantages:
  1. You can specify a different port in line 10, like LPT2:, LPT3:, or even a FILE on disk.
  2. You've closed the printer port at the print job end, making your jobs immediately spooled by Windows.
Practically, you only need to add the OPEN command at the beginning of each job and the CLOSE command at the end, then each "LPRINT" statement should be changed as "PRINT #1,", which can be done with a simple Search & Replace editor tool.

So far you've solved one of your problems, but you still need a DOS compatible printer connected to the port specified in line 10.

Basic cannot directly address USB, DOT4 and other Windows ports which were not available in the age of DOS, so you cannot insert them in Line 10. In addition, more and more printers nowadays are GDI (also known as Windows-Only or host-based printers), which cannot be driven by a DOS program neither if they are connected to LPT1: or if you forward the LPT1: output to one of the ports above with a simple redirection utility like the NET USE Windows command.

These aspects are covered in detail in the article: How to print from DOS to USB Windows-Only printers.

So, you need a Windows program like Printfil to capture the Basic (DOS) print job, convert it into a GDI (Windows) job, THEN forward it to one of the above printers.

Printfil can be configured to capture the LPT output itself, but as a programmer you may want to change the sample source above as follows:

10 D$="c:\basic\printfil.txt"
20 REM D$="LPT1:"
30 OPEN D$ FOR OUTPUT AS #1
40 PRINT #1,"Hello world"
50 CLOSE #1

Depending by whether line 20 is commented (REM) or not, you can make your Basic program printing directly to the LPT1 port (just like LPRINT) or to a file on disk. Now you just have to insert "c:\basic\printfil.txt" in the "File to check" field of the Printfil's configuration dialog to have Printfil automatically capturing your Basic print jobs and forwarding them to any printer installed in your Windows Control Panel (including USB, GDI, DOT4 and virtual printers), without having to configure it to capture the LPT1: output.





Related Article and Tutorials:

How to make PDF documents with the office software?
How to print from Clipper DOS to any Windows printer?
How to print from DOS to USB Windows-Only printers?
How to Resize Windows 2003 Server Partitions?
How to Recover data from Ghost hard disk drives by error?
How to recover files from EXT2/EXT3 Drive?
How to resize a partition on Windows Server?
How to delete Temporary Internet Files?
How to publish the album to the web?
How to Recover Compressed files on NTFS Drive?
How To Run Windows on a Mac?
Tutorial - how to turn your PC into a multi region DVD player?
How do I recover lost files and folders?

  Submit Software | Privacy Policy | Terms of Use | Advertise with Us | Contact Us
 Copyright © BestShareware.net. All rights reserved.