I tried this in kotlin.
Ex-
val dFile=File(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.getPath() + “/” + cFile.nameWithoutExtension + “.” + cFile.extension)
Here is an sample project with exportToFile working:
With this I am able to export my current file with annotations to a different file (asdf.pdf) in my downloads folder. Is it possible for you to provide a working sample project that shows the issue with exportToFile not behaving as you expected?