Hi All,

I would be very grateful if anyone could help with a little issue I am having regarding sending a file to a specific network printer.

Here is a sample of the code I'm using....

FileInputStream fis = new FileInputStream(file);
if (fis == null) {
System.out.print("No File");
return;
}
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

PrintService service = PrintServiceLookup.lookupDefaultPrintService();

aset.add(new PrinterName("ipp:\\witnw21va\ipp\ITDepartment-HP4050", null));
//PrintServiceAttributeSet aset = HashPrintAttributeSet();
PrintService[] pservices = PrintServiceLookup.lookupPrintServices(flavor, aset);

if (service != null){
System.out.println("Default Printer: " + service.getName());

// Creating DocPrintJob
DocPrintJob job = service.createPrintJob();
try{
Doc doc = new SimpleDoc(fis,flavor,null);

PrintJobWatcher pjDone = new PrintJobWatcher(job);

job.print(doc,aset);

// Wait for the print job to be done
pjDone.waitForDone();

fis.close();
}

Many thanks.