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

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Jun 27 11:27:18 UTC 2016


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: http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.00/

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

isSupportedMediaPrintableArea()

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

---------------isSupportedMediaPrintableArea()---------
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.

Regards
Prasanta




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


More information about the 2d-dev mailing list