I'm creating a service that will monitor a specific folder and print any file that is put in this folder. I'm having difficulties with the various file types that could be sent to the folder to be printed.
My first attempt is with Microsoft Office files. What I'm trying to do is start the office to print the file. It's more like a catch, I'm not really using a library or anything like it.
So far this approach would work, but when no Office application has ever started on the machine the Office asks for the user initials. So, in this case my application would just not work, since I'm doing this programatically.
ProcessStartInfo info = new ProcessStartInfo(myDocumentsPath);
info.Verb = "Print";
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(info);
Right now I am trying with Microsoft Office files, but I will apply the same approach for other types as well.
There is anyway to get around the Initials required by the first Office run?
Or any better approach to my problem?
Any help is appreciated, thanks in advance.
There's not really anything that you can do; for the application which will print each type of file that you're going to support, you need to make sure the application is configured correctly.
This means that for office (since it is run as an out-of-process COM server) you should run it under the account that is performing the printing so you can enter the initials and won't be prompted for it when the server attempts to print it.
The same for every other application (assuming the application is executed to print it), it needs to be run as the account the process is going to be run under and configured correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With