[OpenJDK 2D-Dev] [9] RFR 4987884: PrinterJob carries over some values between calls to print.

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Thu Sep 29 09:39:36 UTC 2016



On 9/12/2016 12:33 PM, Prasanta Sadhukhan wrote:
> Hi All,
>
> Updated the spec to clarify that it is expected to use the same 
> attribute set passed to print(PrintRequestAttributeSet) if it is 
> called before no-args print() method for same PrinterJob.
> http://cr.openjdk.java.net/~psadhukhan/4987884/webrev.01/
>
Updated PrinterJob spec as opposed to inner class RasterPrinterJob so 
that javadocs is updated.
http://cr.openjdk.java.net/~psadhukhan/4987884/webrev.02/

Regards
Prasanta
> Regards
> Prasanta
> On 8/29/2016 1:41 PM, Prasanta Sadhukhan wrote:
>> Hi All,
>>
>> If we call
>> -----------------
>> /        pageFormat = job.pageDialog(pageFormat);//
>> //        pageFormat.setPaper(paper);//
>> //        job.setPrintable(p, pageFormat);//
>> ////
>> //        try {//
>> //            job.printDialog();//
>> //            job.print();//
>> //        } catch (PrinterException e) {}//
>> /-------------------
>> then these attributes are added
>> Media, OrientationRequested, MediaPrintableArea, Chromaticity, 
>> PrinterResolution, Copies, SheetCollate, Sides
>> even if we do not change any fields
>> and PageRanges attribute is added if we change page selection from 
>> "All" to "Pages".
>>
>> In light of that, I do not think we can remove PageRanges attribute 
>> from no-args print() method as that will remove user selection.
>>  Or for that matter, any attributes as those can be set via 
>> pageDialog or printDialog.
>>
>> I guess we need to mark this as "Wont fix" . spec also is not clear 
>> if we are not supposed to honour any attributes already set, if we 
>> call no-args print() method.
>> Any comments?
>>
>> Regards
>> Prasanta
>> On 7/5/2016 10:52 AM, Prasanta Sadhukhan wrote:
>>> Hi All,
>>>
>>> Please review a fix whereby it is seen that the PageRanges attribute 
>>> passed to 1st print() call is inadvertently been carried forward to 
>>> 2nd print
>>> if some program tries calling in this sequence
>>> ----------
>>> /PrinterJob pj = PrinterJob.getPrinterJob();//
>>> //pj.setPageable(..)//
>>> //pj.print(..)//
>>> //pj.setPageable(..)//
>>> //pj.print(..)
>>> ------------
>>> /
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-4987884/
>>> /webrev: http://cr.openjdk.java.net/~psadhukhan/4987884/webrev.00//
>>>
>>> /This is because no-args print() uses an internal attribute set 
>>> which is presumed to carry over information not supplied
>>> by the client directly but created during a call to no-args 
>>> printDialog() or during call to setPrintable() called via 
>>> setAttributes().
>>> but it apparently seems, we should not be remembering PageRange 
>>> attribute between calls to print() as it will result in wrong page 
>>> numbers being printed.
>>>
>>> Proposed fix to remove the PageRanges attribute from no-args print() 
>>> between print() calls.
>>>
>>> Regards
>>> Prasanta
>>
>

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


More information about the 2d-dev mailing list