Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zoom in on webview on appearing

I have a UIWebView that loads a PDF that is setup in landscape format and is very hard to read on the iPhone screen. My code is like this:

- (void)viewWillAppear:(BOOL)animated {
NSURL *url = [NSURL URLWithString:_entry.articleUrl];   
NSLog(@"%@",url);
[_webView loadRequest:[NSURLRequest requestWithURL:url]];
self.title = _entry.articleTitle;
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];

}

What are some ways I could set it to be zoomed in more and possibly moved over to the right hand side of the top pdf page?

like image 254
user717452 Avatar asked Jan 24 '26 20:01

user717452


1 Answers

first make sure your UIWebView has scalesPageToFit property enabled

self.myWebView.scalesPageToFit = YES;

And then in your HTML add this tag inside the 'head' tag

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">

you can make maximum-scale=1.5 if that will make it appears better.

I am not sure about if it is a PDF file how to add these tags to it. Maybe you can add the tags and implement the PDF inside the html file.

Here is how to embeded a PDF file inside HTML

<embed src="filename.pdf" width="500" height="375">

Good luck!

like image 94
AK_ Avatar answered Jan 27 '26 10:01

AK_



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!