PDF in UIWebView

I am creating a magazine application. I display every page of my journal in UIWebView. However, web browsing does not fill the PDF screen. There is a border next to it. How can I display it in full screen?

+5
iphone uiwebview
source share
2 answers

I have not tried this with UIWebView, but you can do something similar to programmatically position the border so that it looks on the screen:

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 + 10; frame.size.height = frame.size.height + 10; webView.frame = frame; 

If you use UIWebView to display PDF files and HTML, you will of course only change the frame when displaying the PDF file, and then return the original values ​​when displaying other content.

I did similar things with UIScrollView for another reason: to ensure that the items displayed in UIScrollView are populated so that there is a scrolling failure (as shown in the Apple PhotoScroller example from WWDC 2010). I suppose this may also work to move borders around PDF from the screen.

+4
source share

Checking the scale in the Fit box in IB removed the frame for me.

+4
source share

All Articles