'iOS WKWebview load local PDF Files some pages become black
Solution 1:[1]
This one works for me.
Assuming you are implementing WKNavigationDelegate (YourWebView.navigationDelegate) in your ViewController.
- (void)webView:(WKWebView *)webView
didFinishNavigation:(WKNavigation *)navigation
{
UIView *v = webView;
while (v) {
v.backgroundColor = [UIColor whiteColor];
v = [v.subviews firstObject];
}
}
For reference: Rendering PDF in UIWebView iOS 8, causes a black border around PDF
Solution 2:[2]
For iOS 11.0+ use PDFView
(also see PDFKit) to display a PDF
. PDFView
does not have the issue with black pages.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Fertos |
Solution 2 | christopher.online |