christopherdro / react-native-print

Print documents using React Native
MIT License
325 stars 135 forks source link

How to print Local Pdf, doc file from Gallery #183

Closed muhammad-ahsan099 closed 1 year ago

muhammad-ahsan099 commented 1 year ago

I'm new to here didn't know how to print pdf and doc files from a mobile gallery or local Uri

jrobinsonadrenaline commented 1 year ago

Based on the existing documentation, you should be able to print like this:

RNPrint.print({ printerURL: [url of your printer], //omit if you want to present the print options view filePath:${TemporaryDirectoryPath}${contentId}.pdf//replace with the path to where your doc is stored. }).then(res => console.info(res)).catch(err => console.error(err))

However, it's not working for me since upgrading to iOS 16. The method returns success, the printer stirs but never prints. However, if i replace the PDF with a .txt file in the same directory, it prints fine. I've tried numerous times and methods with no luck. Same result when I remove the printerURL and present the print options view it.

I am also seeing the issue from a native Swift app, so I'm certain it's something to do with Apple. @muhammad-ahsan099 let me know if this works for you, please.

Any one have any workarounds for this issue?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.