-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 1.4.2
-
b10
-
x86
-
windows_2000
Name: jg103975 Date: 02/04/2004
FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
when trying to set the jobname for a print job the outcome is a job name called "My document" which is a windows default.
I've tried assigning the JobName and DocumentName but nothing helps.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the code and specifiy the file name to print. select printer and select print. a print job will be created.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a print job for the printer with the specified job name
ACTUAL -
a print job with a generic "my document" name
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.DocAttributeSet;
import javax.print.attribute.HashDocAttributeSet;
import javax.print.attribute.standard.DocumentName;
import javax.print.attribute.standard.JobName;
import javax.print.attribute.standard.JobPriority;
import java.io.FileInputStream;
import java.io.IOException;
public class PrintPS {
String fileName;
public static void main(String args[]) {
PrintPS ps = new PrintPS(args[0]);
}
public PrintPS(String file) {
fileName = file;
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
PrintRequestAttributeSet aset =
new HashPrintRequestAttributeSet();
/* locate a print service that can handle it */
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(flavor, aset);
/* create a print job for the chosen service */
PrintService service = ServiceUI.printDialog(null, 50, 50,
pservices, null, null, aset);
DocPrintJob pj = service.createPrintJob();
try {
FileInputStream fis = new FileInputStream(fileName);
JobName jobName = new JobName("test1",null);
DocumentName docName = new DocumentName("test2",null);
DocAttributeSet mySet = new HashDocAttributeSet(docName);
PrintRequestAttributeSet pset = new HashPrintRequestAttributeSet();
pset.add(jobName);
Doc doc = new SimpleDoc(fis, flavor, mySet);
/* print the doc as specified */
pj.print(doc, pset);
/*
* Do not explicitly call System.exit() when print returns.
* Printing can be asynchronous so may be executing in a
* separate thread.
* If you want to explicitly exit the VM, use a print job
* listener to be notified when it is safe to do so.
*/
} catch (IOException ie) {
System.err.println(ie);
} catch (PrintException e) {
System.err.println(e);
}
}
}
---------- END SOURCE ----------
(Incident Review ID: 223122)
======================================================================
###@###.### 10/25/04 23:32 GMT
FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
when trying to set the jobname for a print job the outcome is a job name called "My document" which is a windows default.
I've tried assigning the JobName and DocumentName but nothing helps.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the code and specifiy the file name to print. select printer and select print. a print job will be created.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a print job for the printer with the specified job name
ACTUAL -
a print job with a generic "my document" name
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.DocAttributeSet;
import javax.print.attribute.HashDocAttributeSet;
import javax.print.attribute.standard.DocumentName;
import javax.print.attribute.standard.JobName;
import javax.print.attribute.standard.JobPriority;
import java.io.FileInputStream;
import java.io.IOException;
public class PrintPS {
String fileName;
public static void main(String args[]) {
PrintPS ps = new PrintPS(args[0]);
}
public PrintPS(String file) {
fileName = file;
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
PrintRequestAttributeSet aset =
new HashPrintRequestAttributeSet();
/* locate a print service that can handle it */
PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(flavor, aset);
/* create a print job for the chosen service */
PrintService service = ServiceUI.printDialog(null, 50, 50,
pservices, null, null, aset);
DocPrintJob pj = service.createPrintJob();
try {
FileInputStream fis = new FileInputStream(fileName);
JobName jobName = new JobName("test1",null);
DocumentName docName = new DocumentName("test2",null);
DocAttributeSet mySet = new HashDocAttributeSet(docName);
PrintRequestAttributeSet pset = new HashPrintRequestAttributeSet();
pset.add(jobName);
Doc doc = new SimpleDoc(fis, flavor, mySet);
/* print the doc as specified */
pj.print(doc, pset);
/*
* Do not explicitly call System.exit() when print returns.
* Printing can be asynchronous so may be executing in a
* separate thread.
* If you want to explicitly exit the VM, use a print job
* listener to be notified when it is safe to do so.
*/
} catch (IOException ie) {
System.err.println(ie);
} catch (PrintException e) {
System.err.println(e);
}
}
}
---------- END SOURCE ----------
(Incident Review ID: 223122)
======================================================================
###@###.### 10/25/04 23:32 GMT