S
stat
Hi, everyone
i 've been trying to set some printing attributes for a .ps file using
PrintRequestAttributeSet class
but nothing happens.What i want to do is to set the tray on a network
printer(HP LaserJet 4100 Series PCL ). I am able to print fine but
can't set the tray through my prog.
Also notice that i don't want any user interaction(silent print), so
don't wanna use the printDialog().
Any ideas suggestions?
Thanx in advance..
public static void main(String[] args)
{
PrintService defaultPrintService =
PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printerJob = defaultPrintService.createPrintJob();
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
Doc simpleDoc = null;
String psFile = "F:/test.ps";
FileInputStream in = null;
try
{
in = new FileInputStream(psFile);
simpleDoc = new SimpleDoc(in, DocFlavor.INPUT_STREAM.AUTOSENSE,null);
aset.add(PrintQuality.HIGH);
aset.add(new Copies(2));
aset.add(MediaTray.MAIN);
//I would like to print from the buttom(<=>main) tray even when there
are papers in
//another e.g.manual feed,not to print from manual when paper is
present in manual feed
printerJob.print(simpleDoc,aset);
}
catch(Exception e){System.out.println(e.getMessage());}
}
i 've been trying to set some printing attributes for a .ps file using
PrintRequestAttributeSet class
but nothing happens.What i want to do is to set the tray on a network
printer(HP LaserJet 4100 Series PCL ). I am able to print fine but
can't set the tray through my prog.
Also notice that i don't want any user interaction(silent print), so
don't wanna use the printDialog().
Any ideas suggestions?
Thanx in advance..
public static void main(String[] args)
{
PrintService defaultPrintService =
PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printerJob = defaultPrintService.createPrintJob();
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
Doc simpleDoc = null;
String psFile = "F:/test.ps";
FileInputStream in = null;
try
{
in = new FileInputStream(psFile);
simpleDoc = new SimpleDoc(in, DocFlavor.INPUT_STREAM.AUTOSENSE,null);
aset.add(PrintQuality.HIGH);
aset.add(new Copies(2));
aset.add(MediaTray.MAIN);
//I would like to print from the buttom(<=>main) tray even when there
are papers in
//another e.g.manual feed,not to print from manual when paper is
present in manual feed
printerJob.print(simpleDoc,aset);
}
catch(Exception e){System.out.println(e.getMessage());}
}