Imprimir por FTP == Enviar ficheros de texto a una cola de impresión con entrada por FTP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Linq; using System.Text; using System.IO; using System.Net; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://192.168.1.4/barcode.txt"); request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential("", ""); String output = "^XA^FO10,10,^AO,30,20^FDFDTesting^FS^FO10,30^BY3^BCN,100,Y,N,N^FDTesting^FS^XZ"; byte[] outputBytes = Encoding.UTF8.GetBytes(output); request.ContentLength = outputBytes.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(outputBytes, 0, outputBytes.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription); response.Close(); } } } |