[OpenJDK 2D-Dev] [9] RFR JDK-6574279: validatePage from PrinterJob returns argument under linux
Philip Race
philip.race at oracle.com
Wed Aug 3 21:02:30 UTC 2016
High-level question. Why is this not an over-ride in PSPrinterJob ?
I'm afraid I did not get much past the first line of the change :
1662 MediaPrintableArea mpa =
1663 (MediaPrintableArea)getPrintService().
1664
getDefaultAttributeValue(MediaPrintableArea.class);
Read the docs for MediaPrintableArea :-
---
To query for the printable area, a client must supply a suitable context.
Without specifying at the very least the size of the media being used
no meaningful value for printable area can be obtained.
---
.. not to mention you assume a non-null return.
and then you use new Paper() .. which is a constructor which
knows nothing about the printer. It is *speced* to return
US letter with one inch margins.
Another reason why this seems like it should be a sub-class over-ride.
Also this looks wrong ---
1672 if ((imgX*2) + imgWid > wid) {
1673 imgWid = wid - imgX*2;
1674 }
You can't assume equal margins.
-phil.
On 7/12/16, 5:05 AM, Prasanta Sadhukhan wrote:
> Hi All,
>
> Please review a fix for an issue where it is seen that if user sets
> invalid imageablearea via Paper.setImageableArea and
> then calls PrinterJob.validatePage() in linux, then it does not get a
> valid pageformat
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-6574279
> webrev: http://cr.openjdk.java.net/~psadhukhan/6574279/webrev.00/
>
> Fix is to check for margin as noted via CUPS ppdPageSize() and then
> calculate to find the valid margin in validatePaper()
> similar to what we do in native validatePaper() in windows.
>
> Regards
> Prasanta
More information about the 2d-dev
mailing list