trouble rendering pdf

I'm working on a Physics education app. The basis for the app is a UIPageView controller with horizonatal gesture navigation (swipe). Some of the pages are meant to display pdf files. The pdfs are plain pdf (no forms, annotations or other goodies). To display the pdf a view which can draw a pdf is attached as a subview of the individual page UIViewController's view. So far so good.


I have tried in turn using UIWebView, WKWebView and PDFView to draw the pdf. I encountered the following isses:


* UIWebView, WKWebView and PDFViiew all cut a line or so off the bottom of the pdf. This happens when the aspect rario of the view is horizontal (view width greater than view height). If the view's aspect ratio is vertical (higher than wide) the pdf renders as an aspect fit. It uses whatever scale is necessary to fit the entire pdf into the view. Unfortunately I need the horizontal apsect ratio.


* When I used WKWebView it was OK except for the cut off bit... until I upgraded to iOS 12. Now when I swipe a page on, the pdf appears for a few seconds and then disappears, never to be seen again.


* Watching PDFView carefully it seems to make a low res render first followed by a final resolution render. My problem here is that after a few pages it doesn't do the final resolution render on the right-hand half of the view leaving that half blurred.


Any insight greatly appreciated. This is blowing a hole in the app's schedule.

Replies

The way I solved the problem of orientation was to create constraints on the webView :

leading, trailing and bottom at 0 wrt Safe area, Top at 20, as I needed some space above.


The view is then redrawn correctly when I rotate.