Print Raw Text to PDF
This is a short guide on how you can send raw text to the virtual PDF printer
Some of the basic settings of the printer will be changed to accomplish this.
Therefore, a separate printer with a different name is installed.
Using a separate printer, we can preserve the normal PDF printer for
printing PDF file from other programs.
Install the text printer
The new virtual printer for this example is installed with the command line
shown below. It will install a virtual printer named Text to PDF.
Setup_PDFWriter_bioPDF_14_4_0_2963.exe /PRINTERNAME="Text to PDF"
Change the print processor
In order to be able to print text files, we need to change the print processor
for the installed printer. That way Windows knows that the printer should
process raw text.
Go to the Advanced tab in the printer properties and click the
Print Processor button. Set the print processor to
winprint and TEXT.
Share the printer
Before we can map LPT1 to the installed printer, we need to enable
sharing in the printer properties.
Map the printer to LPT1
Mapping LPT1 can be done from the command line with the following
NET USE LPT1 "\\localhost\Text to PDF"
Set the margins
By default, the printer will print to the edge of the paper.
You will most likely want to have some kind of margin.
On the advanced tab in the printer properties dialog, click the
Printing Defaults button. Then click the advanced button.
Select the custom paper size and set the margins.
The margins are the top and left margin.
It will print to the right paper edge if your lines are long enough.
It will also print to the bottom edge if your file has many lines.
You can use normal line breaks to start new lines in the output document.
The form feed character is also supported and will continue
the output on a new page.
If you want to test it, you can download the
It is a short text file that contains a few lines and a formfeed character.
Save it to your hard drive and run this command line:
COPY example.txt LPT1
The PDF printer will print the text file. You can disable the dialogs
and automatically create the file names
using the options dialog for the installed printer.