USB tiskárna a DOS program ve Windows

Máte-li starý DOS program který umí posílat pouze dat do LTP portu nebo COM a chcete novou tiskárnu, narazíte na problem s tiskem. Zabýval jsem se jak tuto skutečnost obejít. Máte-li tento problém, tak právě Vám mohu pomoct. Stačí mě kontaktovat. Některé programy mají své vlastní nádstavby (tiskové manažery) které většinou nejsou zadarmo nebo jsou určeny pouze pro konkrétní program. V novějších windows existuje možnost:

  1. Nainstalovat síťové rozhraní (alespoň Microsoft Loopback Adapter).
  2. V ovládacích panelech tiskáren zvolit tiskárnu a nasdílet ji pro síťový tisk.
  3. V příkazovém řádku zadat:
    net use lpt1 \\nazev_pc\sdilena_tiskarna /persistent:yes
  4. Nastavit tisk na LTP1 nebo jiný port který jste určily.

Metoda 2:

Program kterým se zabývám residentně hlídá data posílaná na port LTP a ukládá do souboru. Z tohoto souboru pak pomocí další, tentokrát  win-utility, provádím tisk na USB tiskárnu. Máte-li zájem o tento program a neporadíte-li s následujícím postupem, tak mě kontaktujte.


(1) Download and install PrintFile (mirror). You should probably create a Start menu item and a desktop shortcut, but you do not need to associate any file types with the program.

(2) Run PrintFile and click the Settings button. In the PrintFile Settings dialog, in the Current Settings field at the top, replace "Default Settings" with "USB Settings" (without the quotation marks).  Under General, add a checkmark next to "Enable spooler function," and remove the checkmark (if any) next to "Show printer selection dialog." I recommend that you add a checkmark next to "Show icon on the taskbar." Under Printer, I strongly recommend that you select the specific printer you want to use, instead of "Use default". 

(3) Still in the PrintFile Settings window, click the Shortcut... button. In the Create PrintFile Shortcut dialog, choose the Desktop type; the Storage directory defaults to a subdirectory named Shortcuts, within the PrintFile directory, and need not be changed. Click OK to close the Create PrintFile Shortcut dialog; press Esc to close the PrintFile Settings dialog, and Exit the main PrintFile dialog. Find the "PrintFile - USB Settings" shortcut that has now been created on your desktop; you will return to it later.

(4) Create a new folder to use as a spool directory for your WPDOS print files. I suggest creating a folder named C:\WPSPOOL. The name of the folder must not be longer than eight characters. You should not use this directory for anything other than print spooling, because any files you place in the directory may be deleted by PrintFile's spooler function. This directory must not be the PrintFile Storage directory that you used in step (3).

Note: If you also use this site's methods for printing to any Windows printer or for faxing from WPDOS to Windows fax software, you may use the same spool directory with each method.

(5) Right-click on the "PrintFile - USB Settings" desktop shortcut that you created in step (3), and select Properties. Click at the end of the existing line in the Target field. Type a space after the quotation mark at the end of the existing line, not inside the existing quotation marks, and then add the following string:

    /s:C:\WPSPOOL\output.prn

Remember to insert a space before (to the left of) this string, and be extremely careful when typing the string itself: do not add any quotation marks, and please note that the string begins with a forward slash, followed immediately (no space) by the letter s and a colon, followed immediately (no space) by the directory name and filename (using backward slashes). The pathname in green (C:\WPSPOOL) should match the folder that you created in step (4). Close the Properties dialog but do not launch the shortcut.

Note for experts only: You can use *.prn or *.* (or any other file specification) instead of output.prn. You may want to write macros that use more than one filename for the output file that is specified in step (6).

(6) Now run WPDOS and edit your printer settings so that the printer output will be directed to a file on your disk. The procedure is slightly different in different WPDOS versions. In WPDOS 6.x, use Shift-F7/Select/Edit, and in the Edit Printer Setup screen, select Port, then Filename, and enter the pathname C:\WPSPOOL\OUTPUT.PRN. In WPDOS 5.1, use Shift-F7/Select Printer/Edit, and in the Select Printer: Edit screen, select Port, choose Other, and enter the pathname C:\WPSPOOL\OUTPUT.PRN. With either version, the directory in the pathname in green (C:\WPSPOOL) should be the folder you created in step (4)

(7) Launch the "PrintFile - USB Settings" shortcut that you modified in step (5). The PrintFile icon should appear in your system tray. Leave the PrintFile program running in the system tray; do not exit or close down PrintFile.

(8) Return to WPDOS and "print" a document. After a few seconds (perhaps as long as a minute under Windows XP), the document should print from your USB printer. If you are running WPDOS in full-screen mode, you do not need to reduce WPDOS to a window, nor do you need to return to the Windows desktop; the entire spooling and printing process occurs in the background. 

(9) If all goes well, make a copy of the "PrintFile - USB Settings" shortcut that you modified in step (5) and add the copy to your Startup group so that it will run whenever you boot into Windows.

Note: If you have a DOS program that (unlike WPDOS) is unable to print to a file, you can print from it to a USB printer by combining Tom Kihlken's utility Prn2file.com with PrintFile. Download the self-extracting archive Prn2file.exe; unpack Prn2file.com into a temporary directory, and follow the instructions in the Prn2file.txt file to set up the program. Use Prn2file to redirect printer output to the same filename specified in step (6) above, and let PrintFile re-redirect the output to your USB printer in the same way it redirects WPDOS output in the steps listed above. If you run Prn2file.com from Autoexec.bat under Windows 95 or 98, it can be loaded into high memory with the LH command; or it may be run from a batch file in a DOS window under any Windows version. (Under Windows NT, 2000, and XP, Prn2file will work properly only if your DOS program can be set up to print to a port that does not really exist on your system, such as  LPT2 or LPT3; if your DOS program can be set up to use one of these port names, add the /P2 or /P3 switch to Prn2file to capture output to the nonexistent port so that it can be re-redirected by PrintFile. This nonexistent-port workaround is not needed under Windows 95, 98, or Me.)

Note: If you want to print to a USB printer from TrueType for WordPerfect or PrimeType for WordPerfect, and your printer is compatible with one of the printers supported by those programs, follow these brief instructions (full details will be posted later):
    Using a text editor, edit the TTWP.CFG or PTWP.CFG file found in your WordPerfect directory. Find the line that begins Port1= and edit it to read something like this: Port1=LPT1,C:\WPSPOOL\OUTPUT.PRN and save the file. If you do not already have a C:\WPSPOOL directory, create it.
    Run WPDOS, select the TT HP LaserJet II printer driver and set it to print to LPT1. Print a file; you will find a file named Output.prn in your C:\Wpspool directory. Now follow the instructions above for redirecting the Output.prn file with the PrintFile utility.

Převzato z http://www.columbia.edu/~em36/wpdos/