On Fri, 18 Jul 2025 13:19:10 GMT, Christian Heilmann <d...@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 with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains five additional 
> commits since the last revision:
> 
>  - 8297191 fixed printing page range for e.g. page 2 to 2 on macOS
>  - 8297191 fixed printing page range for e.g. page 2 to 2 on macOS
>  - Merge branch 'master' of https://github.com/openjdk/jdk into pr/11266
>  - Merge branch 'master' into pr/11266
>  - 8297191 fixed printing page range for e.g. page 2 to 2 on macOS

Add `8297191` to the `@bug` tag in 
`test/jdk/java/awt/print/PrinterJob/PageRanges.java`.

I'm fine if you don't update the `PrinterJob/PageRanges.java` to make it 
runnable.

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java line 327:

> 325:         // Note that firstPage is 0 based page index.
> 326:         int firstPage = getFirstPage();
> 327:         int totalPages = mDocument.getNumberOfPages();

Get rid of `totalPages`.

src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m line 1:

> 1: /*

Bump the copyright year to 2025.

src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h line 1:

> 1: /*

Update the copyright year.

src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m line 1:

> 1: /*

Update the copyright year.

src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m line 145:

> 143:     if (fTotalPages == java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
> 144:     {
> 145:         aRange->length = NSIntegerMax;

Always use `NSIntegerMax` and remove the `fTotalPages` field.

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

Changes requested by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/11266#pullrequestreview-3152815416
PR Review Comment: https://git.openjdk.org/jdk/pull/11266#discussion_r2298979119
PR Review Comment: https://git.openjdk.org/jdk/pull/11266#discussion_r2298983792
PR Review Comment: https://git.openjdk.org/jdk/pull/11266#discussion_r2298984560
PR Review Comment: https://git.openjdk.org/jdk/pull/11266#discussion_r2298986469
PR Review Comment: https://git.openjdk.org/jdk/pull/11266#discussion_r2298982204

Reply via email to