[OpenJDK 2D-Dev] [9] RFR JDK-6575247: Banner checkbox in PrinterJob print dialog doesn't work

Philip Race philip.race at oracle.com
Wed Jul 27 13:50:23 UTC 2016


883         } else {
  884             Class<?>[] supportedCats = getPrintService().
  885                                               
getSupportedAttributeCategories();
  886             for (int i=0;i<supportedCats.length;i++) {
  887                 if (JobSheets.class == supportedCats[i]) {
  888                     pFlags |= JOBSHEET;
  889                     ncomps+=1;
  890                     break;
  891                 }
  892             }

What is wrong with

getPrintService().isAttributeCategorySupported(JobSheets.class) ?

https://docs.oracle.com/javase/8/docs/api/javax/print/PrintService.html#isAttributeCategorySupported-java.lang.Class-

I am also very confused about why you added JOBSHEET
which seems to duplicate the functionality of NOSHEET.

Also it seems to me like it was intentional that the banner page be
printed by default .. which is why the variable was called "*no*JobSheet ..
so as to over-ride that behaviour.

It is kind of what you'd want if you walk over to the shared printer in
your office to have a banner page which declares it as yours ...

So the checkbox should probably be enabled in that case.

Also you should verify that we report the default value for JobSheets
as being STANDARD, not NONE.


-phil.

On 7/27/16, 3:02 AM, Prasanta Sadhukhan wrote:
> Modified webrev to take care of a problem in webrev.01 whereby banner 
> page was getting printed by default.
> Now, banner page will get printed only if the checkbox is checked in 
> printer dialog.
>
> http://cr.openjdk.java.net/~psadhukhan/6575247/webrev.02/
>
> Regards
> Prasanta
> On 7/22/2016 4:26 PM, Prasanta Sadhukhan wrote:
>> Hi Phil,
>>
>> I have modified the code to check if job-sheets is supported and then 
>> only proceed to print the banner page.
>> Also, rectified the jobTitle and banner confusion by adding jobsheet 
>> check.
>> Also added the same code in UnixPrintJob even though I found its 
>> printExecCmd() does not get executed in linux and solaris
>> PSPrinterJob's printExecCmd() is executed instead. In mac, neither 
>> UnixPrinterJob#printExecCmd() nor PSPrinterJob#printExecCmd() gets 
>> executed.
>>
>> Tested on ubuntu and solaris 11 with the fix and banner page is 
>> printed with the fix. In mac, cover page gets printed without any 
>> change.
>>
>> http://cr.openjdk.java.net/~psadhukhan/6575247/webrev.01/
>>
>> Regards
>> Prasanta
>> On 7/20/2016 8:56 PM, Philip Race wrote:
>>> In my evaluation of that bug (which was 9 yrs ago so I do not have
>>> any memory of it :-)), I note that we first need to check
>>> that job-sheets is supported .. you are not doing that ..
>>> what happens if we pass an unsupported option ?
>>> "-o foobar" ?? This needs testing on Linux, OS X, and Solaris 11.
>>>
>>> Also -J (job-title) is something you can see in the queue when
>>> you do lpq. I don't know why it is tied to banner here but
>>> removing it seems wrong. Perhaps this should be renamed from
>>> "banner" and "BANNER" to jobTitle ?? Please examine this.
>>>
>>> In fact you seem to be conflicting with the -o nobanner.
>>>
>>> So in general we have some lack of clarity around job title and 
>>> banner page
>>> (aka job sheet).
>>>
>>> Also we have PSPrinterJob and UnixPrinterJob with similar code.
>>> Please examine it to make sure no similar case is going missed.
>>>
>>> -phil.
>>>
>>> On 7/18/16, 4:27 AM, Prasanta Sadhukhan wrote:
>>>> Hi All,
>>>>
>>>> Please review a fix for an issue where it is seen that Banner page 
>>>> in linux does not get printed despite user selecting the Banner 
>>>> page checkbox in Printer dialog.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-6575247
>>>> webrev: http://cr.openjdk.java.net/~psadhukhan/6575247/webrev.00/
>>>>
>>>> It seems if we pass "-J <bannername>" option to lpr command, it has 
>>>> no effect.
>>>> To print Banner page, we need to pass
>>>> "-o job-sheets=<either of "classified", "confidential", "secret", 
>>>> "standard", "topsecret", or "unclassified">"
>>>>
>>>> Since we support only standard banner or none via a checkbox,
>>>> the proposed fix passes option "-o job-sheets=standard" to lpr 
>>>> command to print the banner page.
>>>>
>>>> Regards
>>>> PRasanta
>>
>



More information about the 2d-dev mailing list