[OpenJDK 2D-Dev] [9] RFR JDK-6789262: getPageFormat doesn't apply PrintRequestAttributeSet specified

Jayathirth D V jayathirth.d.v at oracle.com
Mon Jul 4 11:36:38 UTC 2016

Hi Prasanta,


Changes are working fine.





From: Phil Race 
Sent: Friday, July 01, 2016 11:55 PM
To: Prasanta Sadhukhan
Cc: 2d-dev
Subject: Re: [OpenJDK 2D-Dev] [9] RFR JDK-6789262: getPageFormat doesn't apply PrintRequestAttributeSet specified


+1  ... although I am a little nervous about FP error causing false results in some cases.


On 06/30/2016 11:10 PM, Prasanta Sadhukhan wrote:

Hi Phil,

Right. I have rectified the calculation. Please find the modified webrev:
HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6789262/webrev.02/"http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.02/


On 7/1/2016 3:29 AM, Phil Race wrote:

Shouldn't these all be >= and <= ? 
Else (eg) for X==1 in both cases you would return false when it should be true ..

f ((mpa.getX(units) > mediaPrintables[i].getX(units)) &&


On 06/30/2016 03:31 AM, Prasanta Sadhukhan wrote:

Hi Phil,

I modified the method to check for "fit" rather than perfect match as you suggested.
Please find the modified webrev
HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6789262/webrev.01/"http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.01/


On 6/29/2016 11:29 PM, Philip Race wrote:

This is actually a little subtle.

The check you are deleting has been there since 2000 ..
and it can't just be removed. But it need adjusting.
This is the subtlety. Most of the attribute checks
are yes/no. I think for this one we need to look at
the actual dimensions and return true if it is "fits"
So isSupportedMediaPrintableArea needs to do more than "equals"
I am not 100% sure that won't surprise some other code but
as far as I can think right now it seems the right thing to do.


On 6/27/16, 4:27 AM, Prasanta Sadhukhan wrote: 

Hi All,

Please review a fix for an issue where it was found that setting left margin of 2" is ignored and when we query PrinterJob.job.getPageFormat(PrintRequestAttributeSet)
we get the default paper mediapritable area of x=1" instead of the set 2".

Bug: https://bugs.openjdk.java.net/browse/JDK-6789262
webrev: HYPERLINK "http://cr.openjdk.java.net/%7Epsadhukhan/6789262/webrev.00/"http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.00/

This is because
it was found that getPageFormat() calls Win32PrintService#isAttributeValueSupported() where we call


to check if the mediaprintable area is matching with the media size that has been cached. It gets the paperID by calling findPaperID() and stores the mpa of that paper in MediaPrintableArea[]
I see that my printer supports 43 mediasize names (like iso_a4, iso_a5, na_letter etc) and none of the 43 mediaPrintables equals the mpa value of (50.4, 25.4, 133.8, 246.2)mm

if (mediaPrintables != null) {
            for (int i=0; i<mediaPrintables.length; i++) {
                if (mpa.equals(mediaPrintables[i])) {
                    return true;
So, it seems this check isSupportedMediaPrintableArea() is preventing valid mpa values to be propagated to RasterPrinterJob to be used for printing.

I see in linux and mac, IPPPrintService#isAttributeValueSupported() is called which does not have this isSupportedMediaPrintableArea() check and there this left margin of 2" is not ignored and stored properly.

So, the proposed fix do away with this isSupportedMediaPrintableArea() call from Win32PrintService#isAttributeValueSupported.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160704/d431986b/attachment.html>

More information about the 2d-dev mailing list