简体   繁体   中英

How do I locate/access PDF files generated through my app on iOS?

I'm using https://github.com/christopherdro/react-native-html-to-pdf to generate PDF files . On Android they end up in my Download folder and all is good, on iOS however they end up in:

/var/mobile/Containers/Data/Application/xxxxxxxxxx/Documents/xxxx.pdf

How do users then locate the files? I assumed they would be visible in the "Files" app but they're not. I'm basically doing this for iOS:

let options = {
  html: '<h1>PDF TEST</h1>',
  fileName: 'test',
  directory: 'Documents',
};

I've tried without supplying a directory, or "docs" instead of "Documents" which put them in the same place but /temp instead of /Documents.

Am I doing something wrong? How are iOS users supposed to locate/access the PDF files without having to go through a bunch of stuff to access that folder? Is it possible to make them appear in the "Files" by default?

Thanks in advance.

I figured it out.

You have to add " UIFileSharingEnabled " and " LSSupportsOpeningDocumentsInPlace " into your Info.plist with the value "YES".

That shows the documents folder for your app on an iPhone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM