iOS => Sharing PDF with GMail or WhatsApp does not work...
See original GitHub issueHey there,
i am trying to share a pdf as base64 with Gmail and WhatsApp. Sharing with the “normal” iOS Mail App works just fine, but sharing with WhatsApp & Gmail fails. On Gmail the shared pdf is some kind of weird data with this structure => 123456.dat When sharing to WhatsApp i have several problems.
- When title & message of share options is empty i get an error something like: “This object cannot be sent. Please choose another object.”
- If i add title & message i can only share the title & message text without the pdf file
Here is my code:
RNFetchBlob.config({ fileCache: true })
.fetch("GET", fileUrl)
// the image or pdf is now dowloaded to device's storage
.then(resp => {
filePath = resp.path();
return resp.readFile("base64");
})
.then(async base64Data => {
// here's base64 encoded image or pdf
// type = application/pdf or image/png
base64Data = `data:${type};base64,` + base64Data;
let options = {
type: type,
message: "",
title: "",
// url: type === MIME_TYPE_PDF ? filePath : base64Data
url: base64Data
};
await Share.open(options);
// remove the image or pdf from device's storage
fs.unlink(filePath);
});
I also tried to share the temp file path instead of the base64 but unfortunatley the file path which is downloaded didn’t have the pdf ending 😄 Anyways… it has to work somehow as it works with the iOS Mail App…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
iOS => Sharing PDF with GMail or WhatsApp does not work...
Hey there, i am trying to share a pdf as base64 with Gmail and WhatsApp. Sharing with the "normal" iOS Mail App works...
Read more >Sending PDF file from gmail to WhatsApp - Apple Community
I do not find any issue in sharing a pdf file from an email ... It happens only when trying to send a...
Read more >Top 8 Ways to Fix WhatsApp Not Downloading PDFs on ...
Top 8 Ways to Fix WhatsApp Not Downloading PDFs on iPhone and Android · Open the Settings app on the iPhone. · Scroll...
Read more >FIXED Cannot Send PDF Files, Documents On WhatsApp In ...
Cannot Send PDF Files, Documents On WhatsApp In iPhone. No Send Button In WhatsApp After Update. How to fix cannot send pdf file...
Read more >Can't share PDF file with WhatsApp or email (Only IOS)
I had similar problem in react native share. Then i use react-native-share for sharing my pdf file. Share.open({ title: "Pdf file", ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great! @BigPun86 could you send a PR updating README? Thanks.
This issue might be more related to the fetch-blob. Never mind, this is how i fixed it. I actually extended the config options for the RNFetchBlob.config and added a clear path with filename to it. For Android i just left the old code sharing via base64. Now WhatsApp sharing works perfectly and sharing with Gmail has a extension. I set the pdf extension when filetype is application/pdf else i simply use .png which works for any kind of images shared.