fluttercommunity / flutter_webview_plugin

Community WebView Plugin - Allows Flutter to communicate with a native WebView.
https://pub.dev/packages/flutter_webview_plugin
Other
1.48k stars 930 forks source link

Problems showing pdf #147

Open lgArlequin opened 6 years ago

lgArlequin commented 6 years ago

I have problems trying to show a pdf, in android directly it never loads them and in Ios, it depends on the server, if it is https it shows them, if it is http, it does not show them.

In apple I have no feedback. In Android I have this the first time I run the plugin:

I/WebViewFactory(32731): Loading com.google.android.webview version 68.0.3440.85 (code 344008500)
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
I/cr_LibraryLoader(32731): Time to load native libraries: 4 ms (timestamps 3006-3010)
E/cr_VariationsUtils(32731): Failed reading seed file "/data/user/0/com.example.webviewtest/app_webview/variations_seed_new": /data/user/0/com.example.webviewtest/app_webview/variations_seed_new: open failed: ENOENT (No such file or directory)
I/chromium(32731): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader(32731): Expected native library version number "68.0.3440.85", actual native library version number "68.0.3440.85"
I/cr_BrowserStartup(32731): Initializing chromium process, singleProcess=true
I/cr_base (32731): Android Locale: es_US requires .pak files: []
I/chromium(32731): [INFO:aw_field_trial_creator.cc(52)] First-WebView-Experiment found, group=Enabled
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$6>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$6>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.SafeBrowsingResponseAdapter>
I/art     (32731): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.SafeBrowsingResponseAdapter>
E/libEGL  (32731): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
W/cr_media(32731): Requires BLUETOOTH permission
W/cr_CrashFileManager(32731): /data/user/0/com.example.webviewtest/cache/WebView/Crash Reports does not exist or is not a directory
W/VideoCapabilities(32731): Unrecognized profile 2130706433 for video/avc
W/VideoCapabilities(32731): Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities(32731): Unrecognized profile/level 0/0 for video/mpeg2
W/VideoCapabilities(32731): Unrecognized profile/level 0/2 for video/mpeg2
W/VideoCapabilities(32731): Unrecognized profile/level 0/3 for video/mpeg2
I/VideoCapabilities(32731): Unsupported profile 4 for video/mp4v-es

I'm using WebviewScaffold, but I just realized that when I try to open a fullscreen or a rect, it does not do anything (android). It also does not show any error.

Pdf examples: http://www.pdfpdf.com/samples/Sample1.PDF (not work in android or ios) https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf (only work in ios)

Tested in Iphone 6 (ios 11.4.1), and MotoG3 (android 6.0)

This is my flutter doctor.

[flutter] flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.8-pre.199, on Mac OS X 10.13.6 17G65, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.25.1)
[✓] Connected devices (2 available)
lgArlequin commented 6 years ago

Error in android emulator:

D/cr_Ime  ( 4708): [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents( 4708): onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime  ( 4708): [InputMethodManagerWrapper.java:59] isActive: false
I/cr_Ime  ( 4708): ImeThread is not enabled.
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation( 4708): eglMakeCurrent: 0x94cdb8c0: ver 2 0 (tinfo 0xa30fd010)
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
I/art     ( 4708): Background sticky concurrent mark sweep GC freed 1727(75KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 14MB/14MB, paused 6.713ms total 40.185ms
W/cr_BindingManager( 4708): Cannot call determinedVisibility() - never saw a connection for the pid: 4708
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
W/art     ( 4708): Attempt to remove non-JNI local reference, dumping thread
lgArlequin commented 6 years ago

Apparently it is a problem of the android webview, it is a problem that is repeated on several platforms. The momentary solution that I found is loading the pdf through the google drive viewer "http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf In case someone had this same problem.

Abgaryan commented 5 years ago

Apparently it is a problem of the android webview, it is a problem that is repeated on several platforms. The momentary solution that I found is loading the pdf through the google drive viewer "http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf In case someone had this same problem.

does it work for iOS platform?

lgArlequin commented 5 years ago

@Abgaryan In ios I had no problems with putting the url directly in some cases. try this plugin, work for me: https://pub.dartlang.org/packages/flutter_full_pdf_viewer

MaskyS commented 5 years ago

@lgArlequin, The Webview doesn't render PDFs, unfortunately. The solution you specified works for online files, though there are are some setbacks (there's the GDrive button that you can't get rid of, etc).

flutter_full_pdf_viewer is a good workaround. https://github.com/pycampers/flutter_pdf_viewer also works great, though it isn't inline yet. :)

diazsasak commented 5 years ago

Apparently it is a problem of the android webview, it is a problem that is repeated on several platforms. The momentary solution that I found is loading the pdf through the google drive viewer "http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf In case someone had this same problem.

its work thanks

yugandh commented 5 years ago

I am opening some files with extensions such as .pdf, .mov(video of mac) and unable to open in android webview and able to open ios webview. I am accessing these files from microsoft one drive and connecting to webview to open these files.

Another issue is .png files are not fitting inside one view in android webview, where as in iOS it is fitting on single screen.

Since my one drive microsoft is in webview and i cannot open in flutter_pdf_viewer

Felipe00 commented 4 years ago

Links hosted on AWS does not work too. You guys have Any perspective when this issue will be solve?