RFR: 8223717: javafx printing: Support Specifying Print to File in the API [v3]

Kevin Rushforth kcr at openjdk.java.net
Thu Jun 24 23:22:04 UTC 2021


On Thu, 24 Jun 2021 23:03:29 GMT, Phil Race <prr at openjdk.org> wrote:

>> As a potential user of this API I have to ask, why would this be a URL instead of a File or Path ?  Particularly if only "file:" URLs will be valid.  I can't think of a scenario where it won't always be an extra inconvenience to convert the path I have to a URL.
>
> We aren't ignoring it .. its just handed on, so its going to be the same as the other non-writable case .. file could not be created .. printing error .. 
> we could do some up-front validation if that seems like the way we want to go. This could I guess also check if the file is writeable .. but since the user can select a non-writable file location in the dialog I don't think we should do that part. In which case I wonder about the URL validation too ..

Consistency with other APIs would be the main reason. We could do something similar to what we do for `Image`, and treat a string without a protocol as a file (although not relative to the classpath as in the case of images), turning it into a `file:` URL internally where needed.

@prrace what do you think?

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

PR: https://git.openjdk.java.net/jfx/pull/543


More information about the openjfx-dev mailing list