Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you guys still have an issue concerning the file path and the pdf not getting created in the appropriate folder. #317

Open
hidayat-nur opened this issue Oct 13, 2024 · 0 comments

Comments

@hidayat-nur
Copy link

          If you guys still have an issue concerning the file path and the pdf not getting created in the appropriate folder.

I have found a work around.

Go directly to the source code in your node module
react-native-html-pdf -> android -> com -> christopherdro -> htmltopdf -> RNHTMLtoPDFModule.java
In the convert() function change this code block

File path = (Environment.MEDIA_MOUNTED.equals(state)) ?
          new File(mReactContext.getExternalFilesDir(null), options.getString(DIRECTORY)) :
          new File(mReactContext.getFilesDir(), options.getString(DIRECTORY));

with

File path = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), options.getString(DIRECTORY));

And that should change the file path to the appropriate location inside your emulator/device.

Originally posted by @Allstern in #261 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant