I am having trouble rendering a multi-page PDF file in WkWebView.
If this is one page, it looks fine. But the first page of any multi-page PDF file looks bad. I can’t understand why.

I load the request as follows
wkWebView.load(URLRequest(url: request as! URL))
I keep wkWebView inside another view and avoid scrolling in scrolling (there is a reason for this, I know how scrollView works). Then I set the height of the wWebView and scroll it to the same height as the contentSize.
wkWebView.frame.size.height = wkWebView.scrollView.contentSize.height
wkWebView.frame.size.width = UIScreen.main.bounds.width
wkWebView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
wkWebView.scrollView.delegate = self
source
share