Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emailing single page pdf file as an attachment from iPad using my own app

Tags:

ios

ipad

In my ios app user can send the pdf file as an attachment to some other. It was working on pre ios 7 devices. After upgraded to ios 7 the attachment was missing when app presents the ios mail interface.

Here the code i used to set the mime type:

[mailComposer addAttachmentData:pdfData mimeType:@"application/octet-stream" fileName:fileName];

The above mime type works great on pre ios 7 but on ios 7 it was not taking my file as an attachment. So, i changed the mime type like this:

[mailComposer addAttachmentData:pdfData mimeType:@"application/pdf" fileName:fileName];

It was working fine on ios 7 and pre ios 7 devices but the problem was,On iPad if the attached pdf file has single page then it treated as inline image instead of an attachment. This is happening onnly on iPad on iPhone its fine. Also if i send that mail to some one, On the recipient side also it shows like an inline image when they open that mail on iphone or ipad. since when they tap it it allows two option 1. save image 2. cancel. Also this issue not about ios 7 ipad devices this is happening on all ipad devices which was running under ios 5, ios 6, ios 6.1 and ios 7. Any idea how to resolve it?. What mime type should i use for this to resolve it?.

Note:- for more info please check the attached screenshotenter image description here

-loganathan

like image 224
loganathan Avatar asked Sep 20 '13 13:09

loganathan


People also ask

How do you attach a PDF to a PDF on iPad?

An easy process for combining PDFs on an iPad. Tap “Select files,” then navigate to where the desired PDFs are located to add them to the list. If any PDFs are stored on a cloud-based service, you can add them too. Once you have all the documents, simply hit “Merge” and Acrobat will combine them into one file.

How do you attach a PDF to an email as an icon?

Just look for the “Insert Image” or “Insert Picture” link or icon in the program window. To attach the PDF file to the message, click the “Paperclip” icon on the toolbar, or click “Attach File” on the menu bar.


1 Answers

I have same problem with single page PDF. Just change mimeType to text/pdf instead of application/pdf and it's works.No further change required.

[objMailComposer addAttachmentData:myData mimeType:@"text/pdf" fileName:@"myapp.pdf"];
like image 81
Harin Avatar answered Sep 27 '22 19:09

Harin