Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to Automatically Set Minimum Margins on Print

807591May 12 2008 — edited May 13 2008
I am having a problem determining the minimum margins automatically for printers. The following code works on Windows:

{color:#800000}printJob = PrinterJob.getPrinterJob(); // get a printing object
pageFormat = printJob.defaultPage(); // get the page format
printer = printJob.getPrintService(); // get the default printer;
Paper paper = pageFormat.getPaper();
paper.setImageableArea(0, 0, pageFormat.getWidth(), pageFormat.getHeight()); // set imageable area to size of paper
pageFormat.setPaper(paper);
pageFormat = printJob.validatePage(pageFormat); // should reset imageable area to use minimum margins for the printer{color}

On Linux, using CUPS and Foomatic, the imageable area is not reset to use minimum margins; the imageable area remains set to the full size of the paper.
I used alignmargins to set the minimum margins in the PPD file for the printer, but this had no effect.

Is there a programatic way that I can determine the minimum margins for CUPS?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2008
Added on May 12 2008
4 comments
346 views