Android Question Ftp binary put

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have a PRN file I created in my program that (under Windows I can ftp to my printer)

Pseudo Code

Ftp 192.168.1.2 ' ftp printer address
<enter> ' User Id
Bin ' Enter binary mode
put "File Name" ' put the file to the printer
quit ' Done

Not sure how to do this same code using the FTP library.

Can I send a command Bin and then send a command put

Anyone got an example of this?

This will give me a 3rd way of printing in my program

1) Create PDFs a user can print using Cloud
2) Send PCL codes directly to Bluetooth Printer
3) Ftp PCL codes (from file) directly to printers IP address

Thanks

BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
This is what I tried but does not seem to do anything

B4X:
'--------------------------------------------------------------------------------------------
'  The below parameters are passed in
'--------------------------------------------------------------------------------------------
'      Dim FTP_Address    as String = "192.168.1.2"                   ' Printer Address
'      Dim FTP_UserID      as String = ""                                      ' No USERID Needed
'      Dim FTP_Password  as String = ""                                      ' No Password Needed

       mFTP.Initialize("FTPResults", FTP_Address, 21, FTP_UserID, FTP_Password)
       mFTP.SendCommand("BIN", "")
       mFTP.SendCommand("PUT", File.Combine(File.DirRootExternal, Main.gDirectoryPDFs &"FakeBTPrinter.prn"))
       mFTP.SendCommand("QUIT", "")
       mFTP.Close
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Thanks. Didn't realize that I could just give it an empty string for the last parameter Server File Path.

This is great now I can print to any printer that the user has the IP Address of.

I have another question but will make that another topic.

Thanks works great
 
Upvote 0
Top