react-native-pdf-lib
react-native-pdf-lib copied to clipboard
How to I must do to create file in sdcard or path especific
Hi, good morning, I need create a file in a especific folder into internal memory or into sdcard, how do I do?
If I write sdcard/myfolder/sample.pdf, return "No such file or directory"
If I write:
const docsDir = await PDFLib.getDocumentsDirectory();
const pdfPath = ${docsDir}/sample.pdf;
I can't found the file created in the emulated by react-native.
Regards.
Javier.
You need to create the folder for it to save into first, which this library doesn't give you a way to do. If you use something like https://github.com/joltup/rn-fetch-blob you can create the folder before you put the PDF in there.
Alternatively you could create the PDF, then use rn-fetch-blob to move or copy it into the new directory.
Alternatively you could create the PDF, then use rn-fetch-blob to move or copy it into the new directory.
@thekevinbrown Can you please give an example for this? I wish to save my generated pdf to a path like this: Internal Storage/app name/Export/PDF/reports.pdf