I have a PDF generation project, it consists of some texts and an image that is already stored in db, I want to view and send the created pdf file, everything is fine when there is only text data.
A problem arises if there is an image in our data. The email receives a pdf of 10 MB or higher, even if it has an image of 1 MB or lower. It works great in a simulator. My code for drawing an image is shown below:
UIImage *plotImage=[[UIImage alloc]initWithContentsOfFile:[localPictureArray objectAtIndex:i]]; CGSize imageSize=plotImage.size; CGFloat scaleFactor = 1.0; if (imageSize.height>(maxHeight-currentPageY) || imageSize.width>maxWidth ) { UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, kDefaultPageWidth, kDefaultPageHeight), nil); currentPageY = kMargin; if (!((scaleFactor = (maxWidth / imageSize.width)) > ((maxHeight-currentPageY) / imageSize.height))) { scaleFactor = (maxHeight-currentPageY) /imageSize.height;
Since iam starter iam is trying to solve it.
source share