.NET

Reply
Mentor
GeeHaa
Posts: 156
Registered: ‎04-14-2005
Message 1 of 20 (728 Views)
Accepted Solution

Copy .plt files to a plotter

728 Views, 19 Replies
04-04-2012 12:36 PM

Hi

 

I'm trying to copy plot files to a plotter with filecopy(plotfile,\\server\plottername) it works fine when I have the UNC address but there are network printers without this address that I need to copy files too. I have the IP addresses of these printers.Is there a way to send a file to an IP address?

 

Thanks in advance

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. 

 

Valued Mentor
fieldguy
Posts: 379
Registered: ‎03-31-2005
Message 2 of 20 (721 Views)

Re: Copy .plt files to a plotter

04-04-2012 01:56 PM in reply to: GeeHaa

I have used FTP to do this with several HP devices.  I think all hp printers support ftp.  You can test it from the dos prompt with the following 6 lines:

ftp <enter>

open printer.ip.address  
<login> user
<pword> guest
put "your printfile"

quit

If that works, you can code an ftp transfer using the system.net namespace.  Post back if you want an example.

Mentor
GeeHaa
Posts: 156
Registered: ‎04-14-2005
Message 3 of 20 (715 Views)

Re: Copy .plt files to a plotter

04-04-2012 02:54 PM in reply to: fieldguy

Thanks very much for the response.

 

It lets me login but when I use the put command It gives me .550  the system cannot find the specified file.

 

Im using  Put C:\lisp\X.plt   I tried it with quotes also. But I would like to see the code.

 

Thanks

Valued Mentor
fieldguy
Posts: 379
Registered: ‎03-31-2005
Message 4 of 20 (713 Views)

Re: Copy .plt files to a plotter

04-04-2012 03:29 PM in reply to: GeeHaa

OK.  I will post it in the morning - miller time now.

Try the script from the same folder (c:\lisp) with put "x.plt".

Mentor
SENL1362
Posts: 211
Registered: ‎07-20-2011
Message 5 of 20 (702 Views)

Re: Copy .plt files to a plotter

04-04-2012 11:32 PM in reply to: GeeHaa

This might help you

 

From within DOS command:

net use LPT1 \\PrinterIpAddress\lpr

copy /b C:\temp\xxx.prn LPT1

 

or

lpr -S PrinterIpAddress -P printer -o l  c:\temp\xxx.prn

 

 

Mentor
GeeHaa
Posts: 156
Registered: ‎04-14-2005
Message 6 of 20 (688 Views)

Re: Copy .plt files to a plotter

04-05-2012 10:42 AM in reply to: GeeHaa

I tried changing to the C:\lisp folder and using put "x.plt". Two lines come up, one says 200 Port command successful. The other says 550 The system cannot find the file specified . I tried using lpr but it comes up as an unrecognized command.

 

Thanks

Valued Mentor
fieldguy
Posts: 379
Registered: ‎03-31-2005
Message 7 of 20 (685 Views)

Re: Copy .plt files to a plotter

04-05-2012 11:01 AM in reply to: GeeHaa

I am having trouble (error 550) coding the script.  In other words, I can manually ftp using open and put, but error 550 is persistent in .NET.  I checked my other app and it uploads TIF images to a KIP printer without issue but the same code will not work with my hp laser.

 

There are examples on the internet (http://www.vbforums.com/showthread.php?t=468649) but I do not have the time to figure out why I cannot get that to work.

 

I am leaning towards the "net use" suggestion from SENL1362.  I have used LPR before as well but can't remember where it came from.

 

Sorry!

 

 

Mentor
GeeHaa
Posts: 156
Registered: ‎04-14-2005
Message 8 of 20 (684 Views)

Re: Copy .plt files to a plotter

04-05-2012 11:01 AM in reply to: fieldguy

Oops the put command does work on HP plotters I was trying it on an Oce.

Mentor
SENL1362
Posts: 211
Registered: ‎07-20-2011
Message 9 of 20 (671 Views)

Re: Copy .plt files to a plotter

04-05-2012 11:28 PM in reply to: GeeHaa

using XP? changes are you did not install the Print Services for Unix.

Add Windows components/other network file and print services.

You'll need the i386 part of the xp installation disc.

 

 

Mentor
SENL1362
Posts: 211
Registered: ‎07-20-2011
Message 10 of 20 (667 Views)

Re: Copy .plt files to a plotter

04-05-2012 11:38 PM in reply to: GeeHaa

did you verify the ipadress of the printer ?

try

ping <ipadress>

or

telnet <ipadress>

 

You can log in on these oce printers if you have a root password

telnet XXXXXXX
Trying XXX.XXX.XXX.XXX...
Connected to XXX.XXX.XXX.XXX.
Escape character is '^]'.

Network Printer Server Version 5.6.3 (XXX.XXX.XXX.XXX)

login: root
Password: <root pw here>

Welcome root user

XXX.XXX.XXX.XXX:root> list sysinfo

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!