[OpenJDK 2D-Dev] RFR: 7179006: [macosx] Print-to-file doesn't work: printing to the default printer instead. [v2]

Sergey Bylokhov serb at openjdk.java.net
Fri Sep 25 21:37:41 UTC 2020


On Fri, 25 Sep 2020 18:47:40 GMT, Phil Race <prr at openjdk.org> wrote:

>> A long-standing bug on macOS: https://bugs.openjdk.java.net/browse/JDK-7179006
>> 
>> The fix is to propagate whatever is set as the Destination down to native and set it on the native printing object.
>> 
>> Also if using the native dialog, but with attributes, copy back the destination from native to the Java attribute set.
>> 
>> The new test can directly test printing to file in an automated way - so long as there is a printer.
>> 
>> The updated manual test can be used to verify the  cross-platform dialog case.
>
> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
> 
>   7179006: [macosx] Print-to-file doesn't work: printing to the default printer instead.

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

> 259:                URI destURI = new URI(dest);
> 260:                attributes.add(new Destination(destURI));
> 261:                destinationAttr = "" + destURI.getSchemeSpecificPart();

This destinationAttr in the RasterPrinterJob is usually assigned to:
                destinationAttr = "" + new File(destination.getURI().
                                                getSchemeSpecificPart());
Do we need to do the same here?

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

> 335:     }
> 336:
> 337:     // get the selected printer's name, and set the appropriate PrintService on the Java side

The comment need to be moved up as well?

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

PR: https://git.openjdk.java.net/jdk/pull/339


More information about the 2d-dev mailing list