Am converting a webpage as a pdf file. I did the following,
NSString *string=[NSString stringWithFormat:@"%@.pdf",[chapersArray objectAtIndex:pageIndex]];
[controller1 addAttachmentData:pdfData mimeType:@"application/pdf" fileName:string];
[self presentModalViewController:controller1 animated:YES];
[controller1 release];
Now how can i convert my NSData into pdf and save in my application memory? Kindly help me with sample codes or suggestions. Thanks all.
Am assuming you have your pdf in documents directory here. You can change it to where ever it actually is. Try this -
Essentially using CGPDFDocumentCreateWithProvider you can convert
NSData
to pdf,Don't forget to
CFRelease
all unused data after you are done.You can try with this solution:
I got this is in a simple method as follows,