It's not a secret anymore!
The moose likes Java in General and the fly likes Printing in java: How to set paper size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing in java: How to set paper size" Watch "Printing in java: How to set paper size" New topic

Printing in java: How to set paper size

Rahul Rao

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

Joined: Sep 27, 2003
Posts: 15
Check this out, some changes to be done when u add


DocFlavor psInFormat = DocFlavor.INPUT_STREAM.POSTSCRIPT;
Doc myDoc = new SimpleDoc(pstream, psInFormat, null);
PrintRequestAttributeSet aset =
new HashPrintRequestAttributeSet();
aset.add(new Copies(5));
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 ]
I agree. Here's the link:
subject: Printing in java: How to set paper size
It's not a secret anymore!