开发者

display full screen pdf in uiwebview

I am trying to load pdf in uiwebview but the pdf be displayed with white space on the write hand side

how to let be full screen displayed

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)];

    //webView.contentMode = UIViewContentModeScaleAspectFit;

    NSString *path = [[NSBundle mainBundle] pathForReso开发者_运维问答urce:@" manual" ofType:@"pdf"];
    NSURL *targetURL = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];


    CGRect frame = webView.frame;
    // you may need to modify the 5 and 10 below to match the size of the PDF border
    frame.origin.x = frame.origin.x - 5;
    frame.origin.y = frame.origin.y - 5;
    frame.size.width = frame.size.width + 100;
    frame.size.height = frame.size.height + 100;


    webView.frame = frame; 

     [webView loadRequest:request];

    [self.view addSubview:webView];
    [webView release];


On the webview set the property scalesPagesToFit and you should be ok.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜