I am trying to show a PDF in my iPad application through UIWebView
as shown below.
NSData * responseData = [NSURLConnection sendSynchronousRequest:mutableUrlRequest returningResponse:nil error:nil];
[pdfWebView loadData:responseData MIMEType:@"application/pdf" textEncodingName:@"utf-8" baseURL:nil];
But this doesn't work. Is it a right way to display? If not could anyone guide me in showing the PDF in UIWebView or any other useful method.
Thanks !
For information about basic view behaviors, see View Programming Guide for iOS. In addition to HTML content, UIWebView objects can be used to display other content types, such as Keynote, PDF, and Pages documents. For the best rendering of plain and rich text in your app, however, you should use UITextView instead.
If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. You can debug the HTML, CSS, and JavaScript contained inside a UIWebView with Web Inspector. Read Debugging Web Content on iOS to learn how to configure Web Inspector for iOS.
Set the delegate property to an object conforming to the UIWebViewDelegate protocol if you want to track the loading of web content. You shouldn’t embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.
You shouldn’t embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. You can debug the HTML, CSS, and JavaScript contained inside a UIWebView with Web Inspector.
Got the answer for my question. The below line will do the magic.
[webview loadData:PdfContent MIMEType:@"application/pdf" textEncodingName:@"utf-8" baseURL:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With