Getting the document data from a server using JSON encoded to Base64.
WKWebView is not rendering .docx file accurately. The docx file has logos in header and watermark at the background which is not displayed correctly to the user.
Steps taken to load the docx file in WKWebview:
- Stored the document data on app documents directory.
- Displaying the document file in WKWebView on mobile app with help of local document directory file path.
Below is the code that renders the docx file:
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let filePath = String(format: "%@/%@", documentsPath, "file.docx")
let fileURL = URL(fileURLWithPath: filePath)
docWebView.loadFileURL(fileURL, allowingReadAccessTo: fileURL)
Has anyone encountered this issue? Please provide some assistance to resolve this issue.