[WebView] Error trying to display PDF in web view component
See original GitHub issueHello,
I am trying to display a pdf file from the app bundle but I could not do it, this is what I have done:
<WebView
startInLoadingState={true}
style={styles.web}
url={"localFile.pdf"}
/>
localFile.pdf is obviously included in the bundle but when I try to display this webview it doesn’t show it properly.
From xcode I have got these error messages:
[85869:8794860] DiskImageCache: Could not resolve the absolute path of the old directory. [85869] <Error>: CGAffineTransformInvert: singular matrix. [85869] <Error>: CGAffineTransformInvert: singular matrix. [85869] <Error>: CGAffineTransformInvert: singular matrix.
And I can’t see it
Issue Analytics
- State:
- Created 8 years ago
- Comments:31 (6 by maintainers)
Top Results From Across the Web
how to open the pdf document inside web view using flutter
Try this: import 'dart: html' as html; html.window.open ('http: ///www.website.com/document.pdf');.
Read more >Display PDF in browser Adobe Acrobat, Acrobat Reader
Follow these steps to open a PDF in a web browser.
Read more >Loading errors | PDFTron for Web
Try adjusting the path option in the PDFTron.WebViewer constructor so that it points to the location of your lib folder. Invalid XOD file,...
Read more >WebView - React Native
WebView renders web content in a native view. import React, {Component} from 'react'; import {WebView} from 'react-native';
Read more >WebView control for Windows Forms and WPF - Microsoft Learn
The web view control cannot host arbitrary file types. When an attempt is made to load content that the web view can't host,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Removing the
startInLoadingState={true}
line fixes the issue. The pdf gets displayedTEMPORARY SOLUTION:
I have modified the class RCTWebView and method initWithEventDispatcher to have something like this:
the key to solve the problem it has been the line:
_webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen]bounds]];
previously it was something like this:
_webView = [[UIWebView alloc] initWithFrame:self.bounds];
I guess there is some issue getting the bounds of the webview, that’s why I have specified the main screen bounds.