Is there a way to programmatically scroll to a PDF page within a UIWebView?

前端 未结 5 738
野的像风
野的像风 2020-12-08 23:49

It is possible to use JavaScript to set the pixel y-offset of a UIWebView, e.g.:

[webView stringByEvaluatingJavaScriptFromString:[NSString strin         


        
5条回答
  •  北海茫月
    2020-12-09 00:38

    The uiwebview commonly used to load pdf's has it's own scrollview object that you can make calls to. try something like this:

        [webview.scrollView setContentOffset:CGPointMake(0, webview.scrollView.contentOffset.y + 100) animated:YES];    
    

    This will scroll the view for the pdf down 100 pixels. As for getting the pagenumber of the pdf, I can only imagine that javascript is what you need to take a look at. Or, If you simply know the number of pixels on each page of the pdf, then increment or decrement as necessary. :)

提交回复
热议问题