I have a program that prints labels to a thermal label printer. I need to
intercept the label data before it gets to the printer and modify it with my
program. My program will be distributed to end users, so I need to make it
as seamless as possible for them. I don't want them to have to go manually
create and change printers.
My program will insert itself between the label printing program and the
printer. So I need to programmatically create a "Temporary Printer" that
prints to the label printer. I also need to programmatically change the
"Original Label Printer" to print to a file.
This way, when the label printing program prints a label to the "Original
Label Printer", the data will get written to a file. My program will see the
file get created, modify the data, and then send it out to the "Temporary
Printer" to actually print the modified label.
When my program gets closed, it will restore the "Original Label Printer" to
print directly to the label printer, and remove the "Temporary Printer".
This is not an original idea. I'm trying to duplicate a program that already
does this but the source code has been lost.
I have been able to create the "Temporary Printer" using the AddPrinter API
call, but I don't know how to create a "Print to file" port so that I can
redirect the "Original Label Printer" to it. When the old program is
started, it creates a port called: "C:\temp\label.out" and redirects the
"Original Label Printer" to that port.
I hope I have explained myself clearly enough for you to get the idea of
what i'm doing. Any help is appreciated.
Post by Dave O.I want to use the AddPort & AddMonitor API functions to create a printer
port that writes to a file. But I can find no code examples on how to do
this.
OK, let's take this from the top, what are you actually trying to do? If
you just want to write to a file there are a zillion ways to do that all
of which are easier than writing through a print to file printer port.
Regards
Dave O.