To my amazement, it only took me two weeks of Googling and amateurish hacking to convert an existing VB6 program to a VB.Net equivalent. It is functioning correctly, except for the formerly trivial last step.
The program basically finds or creates a plt file and then copies it to the queue of a large format Xerox printer. This has worked without issue in 32bit XP, but in 64bit Win 7, I get permission errors during the file copy action. Using the Scripting method, I get System.Security.SecurityException CTL_E_PERMISSIONDENIED. Trying System.IO.File.Copy, I instead get System.UnauthorizedException mscorlib.dll Access the to path is denied.
As a test, I ran the command line equivalent (COPY foo.plt networkprintername). In XP, I received a print out as expected; in Win 7, the return line is 'Access is denied. 0 file(s) copied.' What is interesting is if I have that printers' queue window open when I send the command line test, an entry briefly appears and disappears with a Document Name starting with the word 'Remote'.
So far, neither I nor IT can figure out a permissions workaround for this; just curious if anyone else had run into this same problem.
I can think of 2 possible workarounds, but both require more info on your Xerox. I have used FTP and LPR on HP and KIP devices successfully, but not so much success with Seiko (current problem). HP allows generic access to ftp - the others seem to require a legitimate username and password but don't always make those easy to find.
This only works if the printer has a built in print processor that supports generic formats.
Here's a link to LPR for Xerox (http://www.office.xerox.com/userdoc/P750/resource/network.12.html)
Just a WAG: this might be related to the current UAC setting. That can get in the way of certain automated processes (as it is designed to do), especially with relation to permissions to do things in certain local and a lot of remote folder locations.
That occured to the IT guy too. I recall him setting the UAC to nothing whilst remoted-in to my box with no success.
I've done this and its worked:
Dim myProcess As New Process
Dim thisPrinter As String = "TheOneWhoseDriversCreatedThePLT"
Dim someFile As String = "c:\temp\somefile.plt"
Dim arg = "/C COPY /B " & Chr(34) & someFile & Chr(34) & " " & thisPrinter & " && exit"
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.Arguments = arg
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.StartInfo.CreateNoWindow = True
myProcess.Start()
myProcess.WaitForExit(1000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If
myProcess.Close()
Your mileage my vary....
Huh. I tried this snippet of code and... nothing. No print, but also no error or exception written out (I wrapped the MyProcess.Start() in a Try-Catch block).
The only thing that happens is a brief entry in the network printer queue titled "Remote Downlevel Document" with Status of Spooling, my Windows username as the Owner, Pages of N/A while Size, Submitted, and Port remains blank.
With MyProcess.StartInfo
.FileName ="cmd.exe"
.Arguments = strArg
.WindowStyle =ProcessWindowStyle.Hidden
.CreateNoWindow =True
EndWith
Try
MyProcess.Start()
Catch er AsException
Console.WriteLine(er)
EndTry
MyProcess.WaitForExit(1500) 'this is what I already had it set to
The Swamp - I've never understood forum sites that forbid searching without having an account. Guess I'll have to sign up.
Can't find what you're looking for? Ask the community or share your knowledge.