Summary | How use it | Command-line options | Acknowledgments | Support
This page offers a utility that creates PDF output from text files, and optionally prints the PDF to any Windows printer.
You may download WinTextToPDF (for Windows 8 or later) from this link. Unzip the application after downloading. (Note: Some antivirus programs mistakenly report that this application is unsafe, because the AutoIt scripting language that I used when compiling it has also been used for malicious programs. If you don't trust my software, please do not send me an e-mail asking for advice. Use someone else's software instead!)
WinTexToPDF was written in AutoIt and compiled as an application; it contains a copy of the open source text2pdf (written by Phil Smith), which is copied to your temporary-files directory and performs the task of generating the PDF output file.
For printing the PDF output file, the application uses the free PDF-Xchange Viewer, which is included in the PDFtoPrinter program itself. PDF-Xchange Viewer is the only no-cost PDF software that I know of that does all of the following:
AutoIt source code: If you want to modify this application, download the source code here. The files required for compiling are here (the ZIP archive contains some files for use in other applications, not this one; ignore those files). To compile the script, you will need to change all local path references to paths on your own system matching the files in the ZIP; you must also remove the line near the top that contains "Run_After". You may also need to copy the included au3 file to your Program Files(x86)\AutoIt\Include folder.
Updates: This application was updated 22 September 2021. The new version checks the Windows environment to determine whether to create a PDF with the US Letter or A4 paper size. Also, if you change the name of the application so that it includes the string "A4", it will always default to producing A4 output. See further options below.
You may either drop a text file on the application icon, or launch the application and select a text file from a standard file listing. Drop or select only one file at a time.
After a few seconds, the application will create a PDF file in the same directory with the original file, but with ".pdf" appended to the original filename. So, if you drop c:\temp\myfile.txt on to the application, it will create c:\temp\myfile.pdf in the same directory. If the output PDF file already exists, you will be prompted to overwrite it; if you choose Cancel, the application will quit without creating a new output file.
If you want the newly-created PDF file to open in your default PDF viewer (typically Adobe Reader under Windows, or Preview under OS X/macOS), then change the name of the application so that it includes the letter "v", perhaps by adding the word "viewer" to the filename. For example, you might change the name to TextToPDFviewer or something similar, as long as it contains the letter "v".
You may specify the name and location of the output PDF file by running WinPCLtoPDF from the Windows command line, as follows (if you omit the output filename, the program creates a PDF file with the same name as the input filename but with the extension .pdf):
WinTextToPDF c:\path\to\input.txt c:\different\path\to\output.pdf
The application creates either US-Letter- or A4-sized PDF files, depending on the locale of your Windows system. US Letter is used in North America, A4 everywhere else. But see the list of command-line options below.
You may add one or more of the following command-line parameters when running this application from a shortcut, batch file, or the command prompt:
Custom options: You may specify custom optons for the pcl2text conversion progam as follows. Place one or more in a string, and surround them all with a single set of quotation marks. Note that the font and paper-size options that you specify in an options string will override any other command-line settings for font and paper size. This list is taken from Phil Smith's help document:
Note that where one variable is implied by two options, the second option takes precedence for that variable. (e.g. -A4 -y500).
In landscape mode, page width and height are simply swapped over before formatting, no matter how or when they were defined.
I could not have written this application without the help of many experts at the AutoItScript forum,
I cannot help you with bugs or any other problems in text2 pdf or the PDF-Xchange Viewer. If you want to get in touch with me about anything else connected with this applications, please visit this page.
Edward Mendelson (em thirty-six [at] columbia [dot] edu, but with two initials and two numerals before the [at] sign, not spelled out as shown here).