Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Mobile Safari from inserting a PDF's base64 encoded URL into an email when sharing?

I have a javascript web app that generates PDFs client side in a user's browser (using pdfmake).

In mobile Safari a user can open this PDF and view it natively, but when they go to share it by email the message inserts the entire base64 encoded URL for the PDF into the email and it quickly becomes unwieldy.

What workaround do I need to do to stop it from doing that? Is there not some way to specify a default message (perhaps in some meta data) when a user goes to share a document by email?

Currently the user experience is unacceptable because a user has to delete the entire base64 URL before they send their message, which is several pages long.

I would rather not have to send the PDF to a server first to get a smaller URL.

like image 460
Eddy Borja Avatar asked Aug 29 '16 17:08

Eddy Borja


1 Answers

Well, you could circumvent the browsers share by email, by providing your own, leveraging mailto: somewhere the user can see it...

Another idea, untested, is you could wrap the PDF in an iframe, then when the page is forwarded, the host page, not the PDF would be shared, this may require the use of a PDF viewer script, such as google's, something like:

    <iframe src="https://docs.google.com/viewerng/viewer?url={{ URL to your PDF goes here  }}&embedded=true" frameborder="0" height="100%" width="100%">
</iframe>

like image 96
rexfordkelly Avatar answered Nov 15 '22 07:11

rexfordkelly