react-native-pdf-lib icon indicating copy to clipboard operation
react-native-pdf-lib copied to clipboard

How to I must do to create file in sdcard or path especific

Open jochercoles opened this issue 5 years ago • 2 comments

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.

jochercoles avatar Jun 24 '20 14:06 jochercoles

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.

thekevinbrown avatar Oct 02 '20 08:10 thekevinbrown

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

Rishabh-More avatar Nov 21 '20 12:11 Rishabh-More