IPP URLConnection

Anonymous anonymous at easysw.com
Mon Feb 7 11:10:52 PST 2005


Hi,

I was trying to print to a zebra printer using URLConnection and IPP.
But it is not printing to the printer (0 bytes is going to the printer).
PFA that code that i am using.

import java.io.*;
import java.net.*;

public class Reverse {
    public static void main(String[] args) throws Exception {


	String stringToReverse = "^XA^PW2000^FO35,50^AD^FDID: ^FS" +"^FO90,50^AD^FD999999999^FS" +"^FO250,50^B3N,N,50,N,N^FD999999999^FS" + "^FO675,50^AD^FD12/12/2005^FS"
						 +"^FO35,125^AD^FDITM: ^FS" + "^FO90,125^AD^FDRTCA59963499 ^FS" + "^FO250,125^B3N,N,50,N,N^FDRTC:599634^FS" + "^FO675,125^AD^FDWyman 10CH^FS"
						 +"^FO30,200^AD^FDASIN: ^FS" +"^FO90,200^AD^FDB00067WSHA^FS"+ "^FO250,200^B3N,N,50,N,N^FDB00067WSHA^FS"
						 +"^FO35,275^AD^FDBG GK French Terry Pant GREEN / SIZE 439^FS"+ "^XZ^Z";


	URL url = new URL("http://10.89.105.245:631/ipp/port1"); // - As per manual
	//URL url = new URL("http://10.89.105.245:1111/");
	//URL url = new URL("http://10.89.105.245:515/"); - Printer port
	// URL url = new URL("ftp://10.89.105.245:21/"); //- tried ftp also but it gives ILLEGAL filename for PUT error.

	URLConnection connection = url.openConnection();
	connection.setDoOutput(true);

    PrintWriter out = new PrintWriter(
                              connection.getOutputStream());
	out.println(stringToReverse);
	out.flush();

	out.close();

    }
}





More information about the cups mailing list