Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Java printing question

Is it possible to print with printerJob on Win2K/XP with other paper size then defined in the Win-driver ?
0
gaboresz
Asked:
gaboresz
1 Solution
 
yongsingCommented:
Why don't you try it out? Create a Paper object and set the paper size you want. The width and height are specified in units of 1/72 of an inch. The following example set the paper to approximately A4 size.

PrinterJob printerJob = PrinterJob.getPrinterJob();
PageFormat pageFormat = new PageFormat();
Paper paper = new Paper();
paper.setSize(594.936, 841.536);
paper.setImageableArea(72, 36, 450, 769);
pageFormat.setPaper(paper);
printerJob.setPrintable(this, pageFormat);
printerJob.print();
0
 
CleanupPingCommented:
gaboresz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now