How to send text file to printer

user1912935 picture user1912935 · Dec 27, 2012 · Viewed 11.7k times · Source

As i read in some fingerprint manual we can send text file to the printer. Means we can write the program in the text editor and send the whole program as a text file to the printer using the communication program using some transfer commands. for in my host there is a file called myfile.txt in D:/ with the fallowing data

10 PRPOS 200,200
20 DIR 3
30 ALIGN 5
40 PRIMAGE “GLOBE.1”
50 PRINTFEED
RUN

How can i send this file to printer and execute the instrucations to print the image. Please give me some code reference.

Answer

Carey Gregory picture Carey Gregory · Jan 4, 2013

There are several ways to do this from the command line. For example:

type foo.txt > lpt1:

Or

copy foo.txt lpt1:

Or

print foo.txt

Or

notepad /p foo.txt

If you need to do it programmatically, you can execute any of those commands using the system() function or CreateProcess().