RFR: 8297191: [macos] Printing a page range with starting page > 1 results in missing pages [v3]

Alexey Ivanov aivanov at openjdk.org
Tue Nov 25 17:53:53 UTC 2025


On Tue, 18 Nov 2025 15:01:14 GMT, Christian Heilmann <duke at openjdk.org> wrote:

>> This PR fixes a bug that caused no or the wrong set of pages to be printed when using page ranges on macOS.
>> 
>> The main fix is to change the 'location' value of the returned NSRange from the knowsPageRange method to 1 in the native class PrinterView.m.
>
> Christian Heilmann has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Update PrinterView.m
>  - Update PrinterView.h
>  - Update CPrinterJob.m

Referring to [Phil's comment](https://github.com/openjdk/jdk/pull/11266#issuecomment-3247397993),

> So deleting/commenting out these lines
>
> ```
> [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
> [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
> ```
> and ensuring we always set
> ```
> [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
> ```
> Also fixes this bug.
> 
> It seems odd that we have these two ways of doing a similar thing and that they interact like this.

Indeed, it fixes this bug, but it breaks [JDK-8061258](https://bugs.openjdk.org/browse/JDK-8061258) and its test `java/awt/print/PrinterJob/DlgAttrsBug.java`… or maybe not because `DlgAttrsBug.java` fails without either version of the fix.

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

PR Comment: https://git.openjdk.org/jdk/pull/11266#issuecomment-3576826652


More information about the client-libs-dev mailing list