Results 1 to 1 of 1
- 09-10-2009, 01:35 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 3
- Rep Power
- 0
The PrintRequestAttributeSet is not accepting the given attributes.
I have problem with setting the attributes to PrintRequestAttributeSet , printer is not accepting the attributes set in PrintRequestAttributeSet,
none of the follwoing set is not reconized,
aset.add(new Copies(2));
aset.add(MediaTray.BOTTOM);
aset.add(MediaSizeName.NA_LETTER);
it always takes what attributes set in the printer.
I am using following code for printing,
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, null);
DocPrintJob printJob = null;
for (int i = 0; i < services.length; i++) {
if (services[i].getName().equals("MyPrinterNAme")) {
printJob = services[i].createPrintJob();
}
}
Doc doc = new InputStreamDoc(textfile, flavor);
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet ();
aset.add(MediaTray.MANUAL);
aset.add(new Copies(2));
try{
printJob.print(doc, aset);
System.out.println("Prtinting done");
catch (PrintException pe){
System.out.println("Prtinting failed since - " + pe.getLocalizedMessage());
}
What i am doing wrong in this? Is there anything need to configure in the printer for accepting these attributes?
I am using INPUT_STREAM.AUTOSENSE and printing a Text file
Can some one help me on this?
Similar Threads
-
String is not accepting "*" letter, please help me to solve
By srisar in forum New To JavaReplies: 18Last Post: 07-12-2009, 06:47 PM -
java:1652: javax.print.attribute.PrintRequestAttributeSet is abstract; cannot be inst
By Nicholas Jordan in forum Advanced JavaReplies: 0Last Post: 01-05-2009, 08:03 AM -
Socket programming - accepting files
By ravian in forum NetworkingReplies: 2Last Post: 11-29-2007, 11:40 AM
Bookmarks