On Fri, 2 Oct 2026 21:29:04 GMT, Phil Race <[email protected]> wrote:

>> The fix isn't doing anything for me on Ubuntu 26.04
>> I checked that the 2 locations are definitely reached in that 
>> Collate2DPrintingTest.java but the pages still come out uncollated. I'm 
>> using CUPS "driverless" printing with 2 different network printers.
>> The HPIP printer I configured seemed to be not working ..  nothing to do 
>> with Java since a command line "lp foo.txt" was giving me problems, so 
>> although I'd like to try that I'm a bit stuck there.
>
>> @prrace @prsadhuk if you guys could please try manual testing again, I can 
>> confirm that I now have the Collate2DPrintingTest passing on a HP ENVY Pro 
>> 6400 All-in-One Printer on Ubuntu.
> 
> The consequence of that is .. bizarrely .. that I only get one copy printed !
> I undid the change and it was back to 2 uncollated
> then I added it again and it was one copy 
> I did check  (printed to the terminal) that getCopiesInt() was returning 2 at 
> that location in the code.

@prrace how strange! Are you able to list your printer settings? Otherwise some 
things I thought of that could help are:

1. Could you print the result of `execCmd` before returning for 
[`PSPrinterJob`](https://github.com/openjdk/jdk/blob/b22ccb9af5fc7d097f5bf24e0e87a1c02c5810dd/src/java.desktop/share/classes/sun/print/PSPrinterJob.java#L1589-L1590)


execCmd[n++] = spoolFile;
if (IPPPrintService.debugPrint) {
    System.out.println("UnixPrintJob>> execCmd");
    for (int i=0; i<execCmd.length; i++) {
        System.out.print(" "+execCmd[i]);
    }
    System.out.println();
}
return execCmd;


2. Let's also take a look at removing the [PostScript collation 
feature](https://github.com/openjdk/jdk/blob/b22ccb9af5fc7d097f5bf24e0e87a1c02c5810dd/src/java.desktop/share/classes/sun/print/PSPrinterJob.java#L619-L620)


// mPSStream.print(isCollated() ? " /Collate true":"");
mPSStream.print(" /NumCopies " +getCopiesInt()); // maybe remove also?


That should at least get us closer in the right direction. My assumption is 
that the PostScript `setpagedevice` attribute is messing with or being 
interpreted wrong at some stage of processing by the printer driver or printer 
itself. How necessary is the `/Collate` and `/NumCopies` for the generated 
PostScript content?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/33023#issuecomment-5966026674

Reply via email to