First, save the embedded pdf file in the Directory iPhone Simulator document (say demo.pdf). then use the following code in the ViewController.m file in the ViewDidLoad method and remember to add the UIWebViewDelegate to the ViewController.h file.
-(void) viewDidLoad { [super viewDidLoad]; UIWebView theWebView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)]; theWebView.delegate=self; theWebView.scalesPageToFit=YES; [self.view addSubview:theWebView]; NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDir=[paths objectAtIndex:0]; NSString *fileName=[documentDir stringByAppendingPathComponent:@"demo.pdf"]; NSURL *url=[NSURL fileURLWithPath:fileName]; [theWebView loadRequest:[NSURLRequest requestWithURL:url]]; }
source share