Hey all, was wondering if anyone could point me to the right direction. I'm curious about how I would go about creating a PDF programmatically on the iPhone. The documentation mentions CGPDFDocumentCreateWithProvider but i'm not sure how to go about using it. Thanks!
+1
A:
Likewise I do not believe it is possible to view a PDF on the iPhone without an external service to render the output
This is incorrect. You can render a PDF document within a UIWebView
instance, for example:
NSString *urlPathStr = [[NSBundle mainBundle] pathForResource:@"myPDFFile" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:urlPathStr];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:urlRequest];
You can also render a PDF within a UIView
object for better performance.
The PDFKit library is not yet available for the iPhone.
You might look at the QuartzDemo sample application for some Quartz2D methods for rendering and manipulating a PDF document.
Alex Reynolds
2009-08-27 21:52:20