| Author |
Printing in java: How to set paper size
|
Rahul Rao
Greenhorn
Joined: May 14, 2005
Posts: 3
|
|
|
I am printing a documenmt. the need of the document is such that the data is spread on a sheet a little longer than an A4 size paper. I wish to change the paper size by increasing the lenght upto which the printing happens on a A4. How do I set the paper size of this for the purpose of printing.
|
 |
Gopi Kishore
Greenhorn
Joined: Sep 27, 2003
Posts: 15
|
|
Check this out, some changes to be done when u add javax.print.attribute.standard.MediaSize javax.print.attribute.standard.MediaSizeName DocFlavor psInFormat = DocFlavor.INPUT_STREAM.POSTSCRIPT; Doc myDoc = new SimpleDoc(pstream, psInFormat, null); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(MediaSizeName.ISO_A4); aset.add(Sides.DUPLEX); PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, aset); if (services.length > 0) { DocPrintJob job = services[0].createPrintJob(); try { job.print(myDoc, aset); } catch (PrintException pe) {} } [ May 26, 2005: Message edited by: Gopi Kishore ]
|
 |
 |
|
|
subject: Printing in java: How to set paper size
|
|
|