RFR: 8297191: [macos] Printing a page range with starting page > 1 results in missing pages [v2]
Alexey Ivanov
aivanov at openjdk.org
Wed Nov 19 17:23:43 UTC 2025
On Wed, 19 Nov 2025 16:25:46 GMT, eduardsdv <duke at openjdk.org> wrote:
> > On the other hand, as Phil highlighted, should we then communicate our intent of printing the range of pages to macOS and pass the start page correctly as we do now (in the unfixed code) contrasting with always passing 1 in the suggested fix?
>
> The intention to print only a range of pages is communicated to macOS via the `CPrinterJob.javaPrinterJobToNSPrintInfo()`. The `PrinterView.knowsPageRanges()` is used to return the full range of available pages (or the range of pages that program can print) and therefore it must always return the range [1..`Pageable.getNumberOfPages()`].
This is what this PR suggests.
I'm questioning *this approach* now that we know the range of pages was applied twice.
> > And, instead, to modify the code that applies the range for the second time to ensure “we are NOT setting a range within a range”?
>
> The PR fixes precisely this problem, whereby the page range passed via `PageRange` was forwarded twice to macOS. One time in `PrinterView.knowsPageRanges()` and the second time in `CPrinterJob.javaPrinterJobToNSPrintInfo()`, which led to the setting of "a range withing range".
>
> Now, only the `CPrinterJob.javaPrinterJobToNSPrintInfo()` is responsible for passing of `PageRange` to macOS. The `PrinterView.knowsPageRanges()` just returns the number of available pages.
Can we do it the opposite way? This is what I'm asking about.
Report the correct page range to macOS (as it's used to be done) but stop applying this range again on the Java side.
Perhaps, we still need to verify that the page that macOS requests to print is within the range and just print it.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/11266#issuecomment-3553846587
More information about the client-libs-dev
mailing list