SWIFT 3.* & 4.* *
First you have to download that pdf file into your app, after downloading you have to get that file path, then that file path should be use like following way in WKWebView
.
let fileURL = URL(fileURLWithPath: filePathURLData as! String)
//print(fileURL)
webView.loadFileURL(fileURL, allowingReadAccessTo: fileURL)
Here filePathURLData
is your actual file path which you have downloaded into your app, you have to convert this into URL
, then you need to load that file into WKWebView
Thanks
Hope this will help you.
This will show any file in the WKWebView
(doc, docx, xlsx, pdf, google doc, pages & Any textfile)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…