Solved

Custom Printer  Driver

Posted on 2007-11-28
7
529 Views
Last Modified: 2013-12-01
Hi There,
     Got a unique printer driver question.

     Is there a driver or if it can be developed, which will accept the print job from the application and just returns ok (so application presumes that it has printed OK). And then it saves it a temporary file (BYTE BY BYTE) and passes the file as an argument as to another program. Generic Text Only is FINE. It is almost like having a Generic Text/Only printer with FILE port. But in place of prompting the user for a FILE output, it will just save in a temporary file and pass the file to a predefined EXE/BAT file WITHOUT any user intervention.

     You may ask why we are doing this?

     It is quite a unique situation where a legacy software can only PRINT. But we need to the print output to go to a different place than a windows printer!

     It must also be Terminal Services compliant. E.G. the EXE/BAT execution has to happen under the current user session in a multi-user environment.

    If someone can advise something here, it will be greatly appreciated! I am willing to pay for it if development is required:) (I.E. I am desperate)

Cheers
Simon
0
Comment
Question by:simon1663
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 38

Expert Comment

by:hdhondt
ID: 20371088
How about this way:

Using your favourite driver (Generic/tect Only is fine), create a fixed file as its "port". Go to to printer Properties, click on the Ports tab, and click on the Add Port button. Select Local Port and click on the New Port button. For the port name enter the drive, path and name of the file. The driver will now always send its output to that file without any prompting for a name.

Your program should watch that directory and grab the file when one appears.
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 20371221
Here's a simple batch file that watches the temp direcory for a file:

:start
If not exist C:\temp\printfilename goto wait_10_sec
your_program.exe c:\temp\printfilename
del c:\temp\printerfilename
goto start

:wait_10_sec
ping 1.2.3.4 -n 1 -w 10000 > nul
goto start

The ping command tries to ping once, for 10000 ms. The address (1.2.3.4) should not be pingable. To change the delay, change the number 10000
0
 
LVL 8

Expert Comment

by:Thejaka
ID: 20371390
You could use a named pipe to direct the output to a pipe server.
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 

Author Comment

by:simon1663
ID: 20371798
Thanks guys.

Really appreciate the help. The solution seems to work only in single user. We are trying it in a Terminal server with multiple users AND obviously if two people printed at the same time, one's job will overwrite the others! Unless you can add the port with unique names/path. E.g. I tried doing %TMP%\print.txt but that did not work. It needs a full path.
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 20372524
It should work, if you use quotes, i.e. "%TMP%\print.txt"

However, if 2 people print at the same time you will still have problems, unless each one uses a separate filename. You could use something like USERNAME in the filename, i.e. "%TMP%\print%username%.txt". In that case you can then use a loop to find all the files to print, as in:

for %%f in ("%TMP%\print*.txt") do print_it.bat %%f

Where print_it.bat contains this:

your_program.exe %1
del %1
0
 

Author Comment

by:simon1663
ID: 20373745
Thanks hdhondt, but I still get the error : "%TMP%\print.txt" is an invalid port name

I am using Windows XP SP2
0
 
LVL 38

Accepted Solution

by:
hdhondt earned 125 total points
ID: 20377497
Oops, I overlooked that one. I was only thinking of its use within the batch file. You are correct, Windows will not accept wildcards or system variables as part of the port name.

Another way to do it is with something like RedMon, which can redirect a printer port to a program. See:

http://www.cs.wisc.edu/~ghost/redmon/
0

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HP Laserjet 1320 Printer and Windows 10 10 245
Is there a simple front-end menu system. 9 121
Windows 10 - Devices and Printers slow loading 29 725
printing full pages 7 25
Find out what hardware you have and get the most up to date drivers from the manufacturer! Automatically Get Your Drivers There is a number of great programs that will detect your hardware and find drivers for you automatically! Here is a link …
A while back when OPSMGR 2012 was released we were very excited about getting it into our environment and upgrading our 2007 implementation,  we started our planning and we then proceeded with our implementation. All went as planned & our system …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question