True PDF Software
for you!

  • Deutsch
  • English

Print Raw Text to PDF

Print Raw Text to PDF

This is a short guide on how you can send raw text to the virtual PDF printer using LPT1. 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.

Print Raw Text to PDF

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_7PDF_10_25_0_2559_PRO.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.

Rohtext drucken - Print Prozessor

Share the printer

Before we can map LPT1 to the installed printer, we need to enable sharing in the printer properties.

Rohtext - Druckerfreigabe

Map the printer to LPT1

Mapping LPT1 can be done from the command line with the following command.

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.

Rohtext - Drucker Einstellungen

Select the custom paper size and set the margins.

Rohtext - Text Abstände

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.

Try It

If you want to test it, you can download the example.txt. 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.