问题
I'm working with PDF generation,it generated the PDF, viewed using QLPreviewController
, all worked fine except mail forwarding, I have two attachments of type .pdf and .csv. I have the following issues while emailing.
- sometimes no attachments while emailing
pdf size will be very huge when pdf contains image(10 mb for one page pdf, if it contains image)
Problem is when testing in device,in simulator it all works fine..., I come to know some exporting or importing UTI associated issues here since I am a starter I feel difficult to understand it, I think some UTI's I have to add somewhere.. Can anyone please help me to identify the issue and solve, please. Thanks in advance.
回答1:
1. Attachment issue
set mime type as text/csv instead of application/csv or image/csv. code is as shown below
[mailComposer addAttachmentData:[NSData dataWithContentsOfFile:self.csvFilePath]
mimeType:@"text/csv" fileName:[NSString stringWithFormat:@"csvPage.csv" ]];
1. Size issue
I struggled a lot.. at last when wrote image in jpeg format to pdf page using below code, size got reduced ten times!!
UIImage *lowResImage = [UIImage imageWithData:UIImageJPEGRepresentation(plotImage, 0.02)];
来源:https://stackoverflow.com/questions/15173941/issues-with-email-attachment-pdf-and-csv