How to zoom a web page using a pdf file

How to zoom in on UIWebView.

I uploaded a pdf file from the resource package to UIWebView.

Now try to increase web browsing. therefore, it will get the zoom effect for the pdf file.

So.

How can I increase UIWebView.

Any example. Please help me.

+2
source share
3 answers

Just use the following code:

self.pdfviewwebview.scalesPageToFit = YES; self.pdfviewwebview.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); self.pdfviewwebview.delegate = self; 

The most difficult thing that most people forget is to set up a webview delegate, so take care of this.

+5
source
 UIWebView *tempWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)]; tempWebView.backgroundColor = [UIColor whiteColor]; **tempWebView.scalesPageToFit = YES; //this enables the zooming** tempWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); tempWebView.delegate = self; [self.view addSubview:tempWebView]; [self setWebView:tempWebView]; NSString *path = [[NSBundle mainBundle] pathForResource:@"your_file" ofType:@"pdf"]; NSURL *targetURL = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:targetURL]; [self.webView loadRequest:request]; 
+2
source

You can simulate a hard zoom gesture by holding down the Option key. Two gray circles will appear on your simulator, indicating that it imitates a multi-touch gesture, the gesture is compressed to zoom.

-1
source

Source: https://habr.com/ru/post/948618/


All Articles