JDK-6691639 : PrinterJob cross-platform print dialog fails to pass top margin field data
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-04-21
  • Updated: 2016-04-13
  • Resolved: 2016-04-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
On the Page Setup tab of the cross-platform print dialog there is a field to enter the top margin.  The data entered in this field is not passed to the PrintRequestAttributeSet after the dialog is closed.  The other options, left, right and bottom, do modify the value in the AttributeSet.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a PrinterJob and HashPrintRequestAttributeSet.  Open the cross-platform print dialog with PrinterJob.printDialog(PrintRequestAttributeSet).  Attempt to modify the top margin on the Page Setup tab.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
  Top margin would be changed by an entry in the field.
ACTUAL -
  Top margin cannot be changed by entering data in the top margin field.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;

public class PrintTest implements Printable {
    private void render(Graphics g, PageFormat pf) {
        g.drawRect((int)pf.getImageableX(),(int)pf.getImageableY(),72,72);
        g.drawLine((int)pf.getImageableX(),(int)pf.getImageableY(),72,72);
        g.drawLine((int)pf.getImageableX() + 72,(int)pf.getImageableY(),
         (int)pf.getImageableX(),(int)pf.getImageableY() + 72);
    }

    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
        int retcod = Printable.PAGE_EXISTS;
        if (pageIndex == 0) {
            render(g,pageFormat);
        } else
            retcod = Printable.NO_SUCH_PAGE;

        return retcod;
    }

    public static void main(String[] args) {
        PrintTest pt = new PrintTest();
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPrintable(pt);
        HashPrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
//        set.add(new MediaPrintableArea(25.4f,50.8f,165.1f,203.2f,
//         MediaPrintableArea.MM));
        if (pj.printDialog(set)) {
            Attribute[] atts = set.toArray();
            for (Attribute att : atts)
                System.out.println(att);
            /*
            try {
                pj.print(set);
            } catch (PrinterException pe) {
                pe.printStackTrace();
            }
            */
        }
    }
}


---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No workaround.