.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
When I use the open IP address command it opens the right plotter. Ping also works. The telnet command is unrecognized. I tried the code from the link and I still get the 550 file not found error. It says its logged in and everything in the response section of the error status. According to the OCe users manual FTP should work.
Sub TEST()
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create("ftp://ser v/oce tds750/X.plt"), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential("anonymous", "Password")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes("C:\Lisp\X.plt")
' upload file...
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
End Sub
Thanks
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Ok, it's a OCE 750, probably HPGL2 contents to upload.
This requires binary mode because of the non ASCII data.
That's why i mentioned copy /b
see this VB .net 2 sample
http://www.codeproject.com/Articles/17202/Simple-F
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I sort of figured out half of it. On the Oce after logging in and typing binary you have to change directories to the jobs folder on the plotter server. Once I did this the Put "x.plt" command worked now I just have to figure out how to change to this directory in .Net.
Thanks for all your help.
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Here Is what I'm trying. It pops up a command window and it sits open for about 30 seconds as if it was logging in but it does not print and it doesn't throw an exception maybe one of you can see what is wrong.
Dim pr As Process
Dim args As New ProcessStartInfo("cmd.exe")
With args
.RedirectStandardInput = True
.RedirectStandardOutput = True
.UseShellExecute = False
.WindowStyle = ProcessWindowStyle.Normal
End With
pr = Process.Start(args)
pr.StandardInput.WriteLine("echo on" & Convert.ToChar(13)) 'chr(13) Enter key.
pr.StandardInput.WriteLine("CD C:\LISP" & Convert.ToChar(13)) 'chr(13) Enter key.
pr.StandardInput.WriteLine("FTP" & Convert.ToChar(13))
pr.StandardInput.WriteLine("OPEN 192.1.1.164" & Convert.ToChar(13))
pr.StandardInput.WriteLine("anonymous" & Convert.ToChar(13))
pr.StandardInput.WriteLine(Password & Convert.ToChar(13))
pr.StandardInput.WriteLine("binary" & Convert.ToChar(13))
pr.StandardInput.WriteLine("cd jobs" & Convert.ToChar(13))
pr.StandardInput.WriteLine("put " + Chr(34) + "x x.plt" + Chr(34) & Convert.ToChar(13))
pr.StandardInput.WriteLine("bye")
pr.CloseMainWindow()If I try this manually it works fine.
Again thanks very much for your help.
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Isn't writeline already terminating the input with CR+LF
The enter key is CR+LF, so maybe you have to terminate each line with chr(13)+chr(10)
You did not terminate BYE
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Adding the Line Feed after enter works. The only problem is it leaves the Dos window open and does not send the plots until you click inside the window and hit enter. I tried sending an enter and Line feed after bye but it still stays open without sending the files.
Thanks
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I got the code to work for my hp laser. GeeHaa's comment about the "jobs" folder on the printer got me thinking.
I used the same script as before but used "pwd" (print working directory). The printer replied "/" is the current directory. I added an extra slash to the URI in the code and it worked.
Test script from CMD:
ftp
open 192.168.1.1
<login> user
<pword> guest
pwd <enter>
quit
<CommandMethod("ftp4")> _
Public Shared Sub ftp4()
Dim request As FtpWebRequest = _
DirectCast(FtpWebRequest.Create("ftp://192.168.1.1//" & Path.GetFileName("c:\Temp\TEST.TXT")), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = New NetworkCredential("user", "guest")
request.UsePassive = False
request.UseBinary = True
request.KeepAlive = False
request.Proxy = Nothing
'request.r
'Load the file
Dim stream As FileStream = File.OpenRead("c:\Temp\test.txt")
Dim buffer As Byte() = New Byte(CInt(stream.Length - 1)) {}
stream.Read(buffer, 0, buffer.Length)
stream.Close()
'Upload file
Dim reqStream As Stream = request.GetRequestStream()
reqStream.Write(buffer, 0, buffer.Length)
reqStream.Close()
MsgBox("Uploaded Successfully", MsgBoxStyle.Information)
End Sub
The code above can be used to upload plt files to hp printers.
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Unfortunately currently i cannot do tests on any OCE device, but did some tests earlier.
One of tests had to do with the OCE JobTicket, the header info in a OCE PRN file.
Have a look at the the OCE JobTicket 2.6 specifications. One of the setings is JobStore:
JobStore boxname <dbname>
This specifies the name of the Smart Inbox in which the job shall be stored.
BeginTicket 2.6
username JohnSmith
jobname "TestJob 1"
jobStore boxname myqueue
BeginBlock 1
hpgl2 plottertype HP650C origin lowerright sp_eof off merge off
Segment 1
emulation hpgl2
EndBlock
BeginOutput
includeBlock 1
EndOutput
EndTicket
*OceJobData
ESC%0BINBP5,1CO"Océ WPD - version 1.19 build 10.12.07.1"PS37200,11880IP0...
*OceJobEndThis type of PRN files can be submited to the OCE printer either
- using a simple copy command:copy /b C:\temp\oce.prn LPT1
- using youre ftp way of printing probably without the need to change the directory
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
DirectCast(FtpWebRequest.Create("ftp://192.168.1.1/jobs/" & Path.GetFileName("c:\Temp\TEST.TXT")), Thank You both so much. All I did was add Jobs in the URI and it Worked!!!
Re: Copy .plt files to a plotter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
In order to send more than one file at a time (without logging in for each file) using this method do I need to use asynchronous operations?
Thanks



