PrintFilePrinter for Windows

A folder-watching utility that prints or creates PDFs from legacy printfiles or prints dropped PDFs

PrintFilePrinter is a utility that performs two tasks:

1. PrintFilePrinter watches a specified folder for printer output files and either sends them to a printer or converts them to PDF format. This task may be useful for DOS and 16-bit Windows applications that cannot communicate directly with current Windows printers. PrintFilePrinter also provides features that make it possible for DOS applications to exchange data with the Windows clipboard. It may be especially useful with DOSBox or DOSBox-X or with 16-bit applications running under otvdm/winevdm. It is not useful or necessary with vDos, nor with the vDosWP or DOSBoxWP systems, which have most of its features already built-in. It may be more generally useful in Windows 10 or 11; if so, see the notes below on how to create a print-to-file printer in Windows 10 or 11.

2. PrintFilePrinter also serves as a watched folder for PDF files, and will print any PDF file dropped into it, and will optionally further process the dropped file using a user-supplied batch file or application (with an option to process the file without printing it). If you want the program to operate only as a PDF-file folder watcher (for automatic printing and/or processing), and to ignore all other file types, use the command-line switch /pdfonly when starting the program. See the notes below on the PDF processing feature.

You may download the PrintFilePrinter installer here.

During installation, you will be prompted for a directory to watch (typically C:\TEMP) and a default page size (US Letter, Legal, A4). By default, if you use the program's feature that saves a printfile to a PDF, the PDF will be created on the desktop; the installer will ask if you prefer to use a different folder instead. You may also choose an option to run the program when Windows starts up.

The program is a compiled AutoIt script, and your antivirus software will probably warn you against using it. If you don't trust my software, don't use my software. Please do not waste your extremely valuable time writing me an e-mail informing me that your anti-virus program has flagged this software, or asking whether the software is safe.

You may download the AutoIt source code here (it includes irrelevant code taken from some of my other projects).

While this program is running, it continually watches the selected directory (typically C:\TEMP) for newly-created files with these extensions:

I strongly recommend that you do not set the program up to watch a directory containing documents or other files that you want to keep, because this program deletes printfiles (and some files named *.TMP) without warning. So please, when installing this program, designate a watched folder where you do not keep any documents or other files that you want to keep.

You can set up your DOS or 16-bit software to "print" to a file named (for example) C:\TEMP\OUTPUT.PRN and PrintFilePrinter will try to print it to your default Windows printer. It works this way:

If the printfile is named <anything>.RAW, the program will send the data in the file directly to your Windows default printer. If your Windows default printer is compatible with the data, then the data will print. Otherwise, either nothing will happen or you will waste a lot of paper.

If the printfile is named SELECT.RAW, the program will pop up a list of available printers, and you can choose the one to which the program will send the data. Again, the printer will need to be compatible with the data, or nothing will print.

If the printfile is named <anything>.PCL, the program assumes that the file is in fact PCL code; it uses GhostPCL to convert it to a PDF file, and then uses my PDFtoPrinter utility to send the PDF to the default Windows printer.

If the printfile is named SELECT.PCL, the program will pop up a list of available printers, then convert the PCL to a PDF file, and send the PDF to the selected printer.

If the printfile is named PDF<anything except TEMP>.PCL, the program will convert it to a sequentially-numbered PDF file on the Windows Desktop and open the PDF. (If you chose a different folder during installation, the program will save to that folder instead.) See another section of this page for more information on the save-to-PDF feature.

If the printfile is named PDFTEMP<anything>.PCL, then the program will create the PDF in your Windows temporary folder (%TEMP%) and open it for viewing, printing, or saving. This means that you can use output filenames like PDFTEMP2.PCL or PDFTEMP-LadyGaga.PCL and the effect will be the same.

Similarly wth PostScript files. Name the printfile <anything>.PS, SELECT.PS, or PDF<anything except TEMP>.PS or PDFTEMP<anything>.PS, and the program will assume that the data is in fact PostScript code, and will perform the same actions as it does for PCL files, but using GhostScript to convert the PostScript data to PDF. See another section of this page for more information on the save-to-PDF feature.

Similarly with Epson Esc/P files. Name the print <anything>.ESC, SELECT.ESC, or PDF.ESC or PDFTEMP<anything>.ESC, and the progam will perform the same actions as it does for PCL and PS files, using DOSPrinter to convert the Epson Esc/P data to PDF. (If you do not register DOSPrinter with its author, it will print a watermark on some output files.) See another section of this page for more information on the save-to-PDF feature.

If the printfile is named <anything>.PRN, SELECT.PRN, or PDF.PRN or PDFTEMP<anything>.PRN, the program will try to determine if it is PCL, PostScript, Epson Esc/P, or some other kind of code. If it is not PCL, PostScript, or Epson Esc/P, the program will attempt to convert or print it as text, using the freeware Txt2PDF.exe for text conversion. See another section of this page for more information on the save-to-PDF feature.

If, for example, you have chosen US Letter as the default page size, you can force the program to print or convert to Legal size by adding LG immediately before the file extension, as in SELECTLG.PCL. (This does not apply to .RAW files.) You can specify A4 with something like <anything>A4.PCL or US Letter (if it is not the default with <anything>US.PCL. This option applies to the printfiles with the extensions PCL, PS, ESC, and PRN, not to RAW.

If your old DOS application is hard-wired to print to a four-letter port name like LPT1, then do the following. Choose a drive letter not otherwise used in your DOSBox or DOSBox-X setup, perhaps P: which will remind you that that drive letter is used for the Printer output. Patch your DOS application, replacing the string LPT1 with  the string P:\@ so that your application "prints" to a file named "@" (no quotation marks) in drive P:\. If you are running the application under DOSBox or DOSBox-X, then, in the emulator, mount C:\TEMP (or whatever folder that the PrintFilePrinter program is watching) as drive P: so that any file printed from your emulator to P:\@ will be written to the C:\TEMP folder as a file named "@" (no quotation marks). PrintFilePrinter will print a file named "@" in the same way that it prints files named <anything>.PRN - that is, it will test the file to determine if it uses PCL, PostScript, or Epson Esc/P format, and the print it using the method that the program uses for the relevant format; or, if the file is not in any of those formats, the PrintFilePrinter will print the file as plain text.

Note: Using the method described in the preceding paragraph, you can also set the PrintFilePrinter so that it will select a printer when you print from an old DOS application. To do this, patch the port name in your DOS application to P:\% so that the select-printer dialog will appear when you print. Or the PrintFilePrinter program can create a PDF on the desktop; do this by patching the port name in your DOS application to P:# so that any file printed to that name from your emulator will cause an arbitrarily-named PDF file to be created on your Windows desktop.

If you want to specify the name and path of the PDF file created by this program, have your DOS or 16-bit Windows application write the full path of the desired output file in a text file, which must be saved with the name PDFNAME.TMP in the watched folder (typically C:\TEMP). This file must be created before your application prints the printer output file that you want to convert to this named PDF. Typically, a macro (in WordPerfect, XyWrite, etc.) can create this text file and then print to the printfile. (The PDFNAME.TMP file will be deleted after the PrintFilePrinter program reads it and gets the name that it will use for the output PDF file.) If a PDF file with the selected name already exists, you will be prompted to overwrite it or cancel file creation.

To prevent the program from opening and viewing a PDF file that it creates, add this command-line parameter when launching the program from the command line:  /donotopen

While the program is running, you can click on its tray icon for information on its options (and the current watched folder and default page size), or to exit the program.

Clipboard support

This system also supports text exchange to and from the Windows clipboard. If you "print" a file named CLIPOUT.TMP to the watched folder, the contents of that file will be copied to the Windows clipboard (any closing carriage-return-line-feed will be removed). If your file is not pure ASCII, then "print" a file named either CLIP437.TMP (for DOS programs running in codepage 437), CLIP850.TMP (for DOS programs running in codepage 850 or 858) or CLIP1252.TMP (for output from 16-bit Windows programs).

You can also "print" a file that tells this system to save the Windows clipboard to a file, so that your application can open that file and get the contents of the clipboard. The file to print to the watched folder should be named GETCLIP.TMP (it can be empty or not; the contents don't matter); a file named SENDCLIP.TXT will be created in the watched folder, containing the contents of the Windows clipboard. Your application can then retrieve the contents of this file.

About the save-to-PDF feature

If the name of your output printfile is PDF*.PCL (or PDF*.PS or PDF*.PRN, etc., but not PDFTEMP.*) then the program, by default, will save a PDF to your Windows desktop with a sequentially numbered name in the form File0000.pdf. If you specified a different save-to-PDF folder during installation, then the program will use that folder instead of your desktop.

You can control the name of the saved PDF by setting your output printfile to be named something like PDF-XY.PCL, with two or three characters after PDF-. If you do this, then the saved PDF will be named XY0000.PDF, and the two or three characters that followed "PDF-" in the printfile filename will be used as the two characters that precede the number in the saved output PDF filename.

About the PDF-processing feature

When a PDF file is dropped into the watched folder (and the PDF can be one created by another application or by this program itself when converting a print file to a PDF), the PDF will be printed and then, optionally, processed by a batch file or application program provided by the user.

The batch file or application used for processing should take a quoted filename as its only parameter. For example, if you create a command file named ProcessMyPDF.cmd, then PrintFilePrinter will run this command using the name of dropped file as a parameter:

ProcessMyPDF.cmd "filename.pdf"

It will run this command from the directory to which the progam copies the dropped PDF, so your command file or application does not need to specify an input path.

For example, your batch or command file might look something like this (%1 will be expanded to the quoted form of the filename of the dropped PDF):

@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
rem set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"
rem echo datestamp: "%datestamp%"
rem echo timestamp: "%timestamp%"
rem echo fullstamp: "%fullstamp%"
copy %1 "c:\path\subdir\%fullstamp%.pdf"

To use this feature, launch PrintFilePrinter with the command-line parameter:


To process (but not print) a dropped PDF file, use the command-line switch /noprintdrop and also the /proccmd= switch described above. If you specify /noprintdrop without also specifying the /proccmd= switch, the program will exit with an error message, because this combination of switches would cause the program merely to delete a dropped PDF file, without having done anything with it, which is probably not what you want. 

How to create a print-to-file printer in Windows 10 or 11

It may be useful to have a Windows printer driver that creates and displays a temporary PDF file that you can print or save or abandon. Use this method to create a driver that sends PostScript output to the PrintFilePrinter system described above:

With PrintFilePrinter running, you can "print" to this Windows printer and a PDF file will open in your default PDF application.

You may also use any Windows PCL printer driver that works smoothly with your 16-bit application; replace .PS in the instructions above with .PCL.

To use Microsoft's "Generic Color PostScript Driver for Commerical Printing" printer driver (which was distributed with many older versions of Microsoft Office Professional), download this .zip archive, extract it to your desktop, and then perform the steps above, with this exception:

Edward Mendelson (edward [dot] mendelson [at] columbia [dot] edu)