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

前端 未结 5 740
野的像风
野的像风 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:42

    I have faced a similar problem, in which I had to scroll to particular page in PDF (which is displayed using UIWebView) on selection of a cell corresponding to that page in tableView (thumbnail tableview).

    So I wrote a piece of code which allows you to scroll to particular page in PDF.

    I am not using any javascript code. I am just keeping track of the zoom scale applied to the original PDF page each time and calculating the updated offset required to scroll to each page. So, this works even if the PDF is in zoomed state.

    You can find the code here.

提交回复
热议问题