Closed Guillecaba closed 2 years ago
Same problem, any solution?
I'm trying to use app private storage to store the pdf and then open it! it works properly on android 10 and below, but can't be accessed with API_30 devices, Even the action RNHTMLtoPDF.convert(options) doesn't work when I call it!
Same problem. Any update on supporting this library for target sdk version 30
I had a similar problem, but not using the documents folder (because this is the system's documents folder) as mentioned in the documentation fixed the issue for me. This was mentioned in another issue here: https://github.com/christopherdro/react-native-html-to-pdf/issues/185.
If you need to store the file for a longer period of time, you could use another library such as https://github.com/itinance/react-native-fs to store it in your app's local folders to comply with Android 11.
@RemyLivewall , Removing directory from options will store the pdf file in apps internal cache folder. This will not allow to view the document. As per my requirement, I have to store pdf document in external folder like downloads/documents so Users can view file from Device's Path.
Same problem. How to use this library to comply with Android 11?
Setting directory to Documents
works for me. :D
Setting directory to
Documents
works for me. :D
@NourAliAbdou - Not working in Android 11
Any update on this
Any Update? :(
Has anyone found a workaround or an alternative library for this situation?
Removing directory parameter works for me. I was using directory as "documents".
Hey I was facing the same issue in target SDK 30 and gladly found a solution. First look at my code
async function createPDF(params) {
const html = getHTMLPage(params);
const options = {
html,
fileName: getFileName(params.entryType),
directory: 'Documents',
// height: 792,
// width: 612,
};
const file = await RNHTMLtoPDF.convert(options);
RNFetchBlob.android.actionViewIntent(file.filePath, 'application/pdf');
}
I was saving the file to Documents
directory and it was just saving fine (log the file after save) but when i was viewing the file with RNFetchBlob
that's where I was getting the error. So my problem was with viewing the file with RNFetchBlob
. If your problem is same try to add these lines in AndroidManifest.xml
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="*/*" />
</intent>
</queries>
Hope it solves your problem.
Hey I was facing the same issue in target SDK 30 and gladly found a solution. First look at my code
async function createPDF(params) { const html = getHTMLPage(params); const options = { html, fileName: getFileName(params.entryType), directory: 'Documents', // height: 792, // width: 612, }; const file = await RNHTMLtoPDF.convert(options); RNFetchBlob.android.actionViewIntent(file.filePath, 'application/pdf'); }
I was saving the file to
Documents
directory and it was just saving fine (log the file after save) but when i was viewing the file withRNFetchBlob
that's where I was getting the error. So my problem was with viewing the file withRNFetchBlob
. If your problem is same try to add these lines inAndroidManifest.xml
<queries> <intent> <action android:name="android.intent.action.VIEW" /> <data android:mimeType="*/*" /> </intent> </queries>
Hope it solves your problem.
I have used this before, and it has fixed the issue. but the problem what I am facing is that when I reinstall the app and use convert function, app are crashed. but when I clear the all download content that were download using old same app, working fine...
Does anyone find the solution?
Any update on this?
Does anyone find the solution or any alternative library?
same here also does anyone have solution
I was updating my project to React native 0.64.2 and my sdk is pointing to version 30, in preparation for the request from the playstore for November, but I am having problems with this library with devices with android 11
Error: RNHTMLtoPDF error: Could not create folder structure.
is the error that is giving me.Before to support sdk 29 i used
android: requestLegacyExternalStorage = "true"
but this will no longer be a solution for android 11, what would be the solution now for android 11 target sdk30?