Bug 60775 - Display a Local PDF File in a WebView for Android using pdfjs not working
Summary: Display a Local PDF File in a WebView for Android using pdfjs not working
Status: NEEDINFO
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 7.1 (C9)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-20 17:12 UTC by Matt Ingle
Modified: 2017-12-08 19:33 UTC (History)
2 users (show)

Tags: pdfjs Android
Is this bug a regression?: Yes
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 60775 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEEDINFO

Description Matt Ingle 2017-11-20 17:12:36 UTC
I have followed the sample at https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/display-pdf/ but have found that it does not work in version 7.1.1 (API 25) simulator. The PDF doesn't display at all.

This the error I see in the Debug Output.

[ERROR:gl_context_egl.cc(96)] eglCreateContext failed with error EGL_BAD_CONFIG
11-20 11:00:56.290 E/EGL_emulation( 4384): eglCreateContext: EGL_BAD_CONFIG: no ES 3 support
11-20 11:00:56.290 E/EGL_emulation( 4384): tid 4434: eglCreateContext(1384): error 0x3005 (EGL_BAD_CONFIG)
11-20 11:00:56.290 E/chromium( 4384): [ERROR:gl_context_egl.cc(96)] eglCreateContext failed with error EGL_BAD_CONFIG

This does work in version 6.0 (API 23). I also tried version 7.0 (API 24) and 8.0 (API 26). In 7.0 the PDF begins to render but is unreadable. In 8.0 the PDF doesn't display either.
Comment 1 Jon Douglas [MSFT] 2017-11-27 18:50:17 UTC
Hi Matt,

Thanks for reporting a bug. 

I am not able to reproduce this on an API 25 emulator. The PDF displays just fine. Can you please confirm what emulator image and device you are emulating? My quick test was a Pixel API 25 - 7.1.1(Google APIS) (x86_64).

Secondly can you provide your version information such as your IDE version and Xamarin.Android version?

Tested on 15.4.4
Comment 2 Matt Ingle 2017-12-06 16:51:54 UTC
AVD Information:
Device: Nexus 5 (4.95", 1080x1920 xxhdpi)
Target: Android 7.1.1 - API Level 25
CPU/ABI: Google APIs Intel Atom (x86)
RAM: 2048
VM Heap: 64
Use Host GPU

IDE: VS 2017 ver. 15.4.4
Xamarin: 4.7.10.38 (34c1b6c)
Xamarin.Andriod.SDK: 8.0.2.1 (HEAD/c2a33d8ea)


Please let me know if you need any more information.
Comment 3 Matt Ingle 2017-12-08 19:17:45 UTC
Here is the Debug Log for the same AVD configuration running Android 7.0 - API Level 24.

[0:] App was started but user was already authenticated.
12-08 14:05:39.825 D/Mono    ( 4322): Unloading image System.dll [0x868c2100].
12-08 14:05:39.825 D/Mono    ( 4322): Image addref System[0x90a8bfc0] -> System.dll[0x93ff9900]: 17
12-08 14:05:39.826 D/Mono    ( 4322): Unloading image System.dll [0x90834400].
12-08 14:05:39.827 D/Mono    ( 4322): Image addref System[0x8df76f00] -> System.dll[0x93ff9900]: 19
12-08 14:05:39.827 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.827 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.827 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.827 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.828 D/Mono    ( 4322): Unloading image System.dll [0x868c2100].
12-08 14:05:39.828 D/Mono    ( 4322): Image addref System[0x90a8bfc0] -> System.dll[0x93ff9900]: 19
12-08 14:05:39.828 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.828 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.828 D/Mono    ( 4322): Unloading image System.dll [0x868c2100].
12-08 14:05:39.829 D/Mono    ( 4322): Image addref System[0x90a8bfc0] -> System.dll[0x93ff9900]: 20
12-08 14:05:39.829 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.829 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.832 D/Mono    ( 4322): Unloading image System.dll [0x90834400].
12-08 14:05:39.832 D/Mono    ( 4322): Image addref System[0x8df76f00] -> System.dll[0x93ff9900]: 21
12-08 14:05:39.832 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.832 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.832 D/Mono    ( 4322): Unloading image System.dll [0x90834400].
12-08 14:05:39.833 D/Mono    ( 4322): Image addref System[0x8df76f00] -> System.dll[0x93ff9900]: 22
12-08 14:05:39.833 D/Mono    ( 4322): Config attempting to parse: 'System.dll.config'.
12-08 14:05:39.833 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'.
12-08 14:05:39.859 W/Mono    ( 4322): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:05:39.860 D/Mono    ( 4322): Unloading image System.Core.dll [0x868c2b00].
12-08 14:05:39.860 D/Mono    ( 4322): Image addref System.Core[0x917f33c0] -> System.Core.dll[0xa5d54200]: 19
12-08 14:05:39.860 D/Mono    ( 4322): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:05:39.860 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
12-08 14:05:39.860 W/Mono    ( 4322): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:05:39.860 D/Mono    ( 4322): Unloading image System.Core.dll [0x868c2b00].
12-08 14:05:39.861 D/Mono    ( 4322): Image addref System.Core[0x917f33c0] -> System.Core.dll[0xa5d54200]: 20
12-08 14:05:39.861 D/Mono    ( 4322): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:05:39.861 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
12-08 14:05:39.871 W/Mono    ( 4322): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:05:39.872 D/Mono    ( 4322): Unloading image System.Core.dll [0x87ab0600].
12-08 14:05:39.873 D/Mono    ( 4322): Image addref System.Core[0x8557dde0] -> System.Core.dll[0xa5d54200]: 21
12-08 14:05:39.873 D/Mono    ( 4322): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:05:39.873 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
12-08 14:05:39.873 W/Mono    ( 4322): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:05:39.873 D/Mono    ( 4322): Unloading image System.Core.dll [0x87ab0600].
12-08 14:05:39.873 D/Mono    ( 4322): Image addref System.Core[0x8557dde0] -> System.Core.dll[0xa5d54200]: 22
12-08 14:05:39.873 D/Mono    ( 4322): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:05:39.873 D/Mono    ( 4322): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
[0:] android.support.v7.view.menu.ActionMenuItemView
[0:] android.support.v7.view.menu.ActionMenuItemView
12-08 14:05:45.065 D/cr_Ime  ( 4322): [InputMethodManagerWrapper.java:30] Constructor
12-08 14:05:45.068 W/cr_AwContents( 4322): onDetachedFromWindow called when already detached. Ignoring
12-08 14:05:45.068 D/cr_Ime  ( 4322): [InputMethodManagerWrapper.java:59] isActive: false
12-08 14:05:45.080 I/cr_Ime  ( 4322): ImeThread is not enabled.
12-08 14:05:45.110 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:45.155 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:45.259 W/cr_BindingManager( 4322): Cannot call determinedVisibility() - never saw a connection for the pid: 4322
12-08 14:05:45.259 D/cr_Ime  ( 4322): [InputMethodManagerWrapper.java:59] isActive: false
[INFO:CONSOLE(0)] "The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.", source: file:///android_asset/pdfjs/web/viewer.html?file=%2Fstorage%2Femulated%2F0%2FDownload%2F214_loadsheet.pdf (0)
12-08 14:05:45.422 I/chromium( 4322): [INFO:CONSOLE(0)] "The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.", source: file:///android_asset/pdfjs/web/viewer.html?file=%2Fstorage%2Femulated%2F0%2FDownload%2F214_loadsheet.pdf (0)
12-08 14:05:45.503 I/art     ( 4322): Background sticky concurrent mark sweep GC freed 352(43KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 24MB/24MB, paused 5.766ms total 22.126ms
12-08 14:05:45.513 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:45.576 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.731 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.773 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.815 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.878 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.926 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:46.959 W/cr_BindingManager( 4322): Cannot call determinedVisibility() - never saw a connection for the pid: 4322
12-08 14:05:46.990 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
[INFO:CONSOLE(1607)] "PDF 347a3d0ccefb314f8d7b7e762006e599 [1.5 Microsoft® Excel® 2010 / Microsoft® Excel® 2010] (PDF.js: 1.9.426)", source: file:///android_asset/pdfjs/web/viewer.js (1607)
12-08 14:05:47.004 I/chromium( 4322): [INFO:CONSOLE(1607)] "PDF 347a3d0ccefb314f8d7b7e762006e599 [1.5 Microsoft® Excel® 2010 / Microsoft® Excel® 2010] (PDF.js: 1.9.426)", source: file:///android_asset/pdfjs/web/viewer.js (1607)
12-08 14:05:47.047 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.112 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.401 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.497 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.571 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.618 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.687 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
12-08 14:05:47.881 W/art     ( 4322): Attempt to remove non-JNI local reference, dumping thread
Comment 4 Matt Ingle 2017-12-08 19:33:13 UTC
This the Debug Log from same AVD configuration running Android 6.0 - API Level 23. This one renders the PDF correctly.

[0:] App was started but user was already authenticated.
12-08 14:22:38.422 W/Mono    ( 3820): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:22:38.423 D/Mono    ( 3820): Unloading image System.Core.dll [0x9adf0200].
12-08 14:22:38.423 D/Mono    ( 3820): Image addref System.Core[0xadc96580] -> System.Core.dll[0xa9b4e200]: 17
12-08 14:22:38.423 D/Mono    ( 3820): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:22:38.423 D/Mono    ( 3820): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
12-08 14:22:38.424 W/Mono    ( 3820): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
12-08 14:22:38.424 D/Mono    ( 3820): Unloading image System.Core.dll [0x9adf0200].
12-08 14:22:38.426 D/Mono    ( 3820): Image addref System.Core[0xadc96580] -> System.Core.dll[0xa9b4e200]: 18
12-08 14:22:38.426 D/Mono    ( 3820): Config attempting to parse: 'System.Core.dll.config'.
12-08 14:22:38.426 D/Mono    ( 3820): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
[0:] android.support.v7.view.menu.ActionMenuItemView
[0:] android.support.v7.view.menu.ActionMenuItemView
12-08 14:22:38.545 W/art     ( 3820): Attempt to remove non-JNI local reference, dumping thread
12-08 14:22:38.548 W/AwContents( 3820): onDetachedFromWindow called when already detached. Ignoring
12-08 14:22:38.639 D/EGL_emulation( 3820): eglCreateContext: 0x916672a0: maj 2 min 0 rcv 2
12-08 14:22:38.641 D/EGL_emulation( 3820): eglMakeCurrent: 0x916672a0: ver 2 0 (tinfo 0x957be470)
12-08 14:22:38.687 D/EGL_emulation( 3820): eglCreateContext: 0x91667360: maj 2 min 0 rcv 2
12-08 14:22:38.688 D/EGL_emulation( 3820): eglMakeCurrent: 0x91667360: ver 2 0 (tinfo 0x957be470)
12-08 14:22:38.764 W/BindingManager( 3820): Cannot call determinedVisibility() - never saw a connection for the pid: 3820
12-08 14:22:38.767 D/EGL_emulation( 3820): eglMakeCurrent: 0x916672a0: ver 2 0 (tinfo 0x957be470)
12-08 14:22:38.770 D/EGL_emulation( 3820): eglMakeCurrent: 0x91667360: ver 2 0 (tinfo 0x957be470)
[INFO:CONSOLE(0)] "The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.", source: file:///android_asset/pdfjs/web/viewer.html?file=%2Fstorage%2Femulated%2F0%2FDownload%2F214_loadsheet.pdf (0)
12-08 14:22:38.850 I/chromium( 3820): [INFO:CONSOLE(0)] "The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.", source: file:///android_asset/pdfjs/web/viewer.html?file=%2Fstorage%2Femulated%2F0%2FDownload%2F214_loadsheet.pdf (0)
12-08 14:22:39.023 D/EGL_emulation( 3820): eglMakeCurrent: 0x916672a0: ver 2 0 (tinfo 0x957be470)
12-08 14:22:39.096 E/eglCodecCommon( 3820): glUtilsParamSize: unknow param 0x00008cdf
12-08 14:22:39.096 E/eglCodecCommon( 3820): glUtilsParamSize: unknow param 0x00008824
12-08 14:22:39.096 E/eglCodecCommon( 3820): glUtilsParamSize: unknow param 0x00008cdf
12-08 14:22:39.096 E/eglCodecCommon( 3820): glUtilsParamSize: unknow param 0x00008824
12-08 14:22:39.622 W/BindingManager( 3820): Cannot call determinedVisibility() - never saw a connection for the pid: 3820
[INFO:CONSOLE(1607)] "PDF 347a3d0ccefb314f8d7b7e762006e599 [1.5 Microsoft® Excel® 2010 / Microsoft® Excel® 2010] (PDF.js: 1.9.426)", source: file:///android_asset/pdfjs/web/viewer.js (1607)
12-08 14:22:39.660 I/chromium( 3820): [INFO:CONSOLE(1607)] "PDF 347a3d0ccefb314f8d7b7e762006e599 [1.5 Microsoft® Excel® 2010 / Microsoft® Excel® 2010] (PDF.js: 1.9.426)", source: file:///android_asset/pdfjs/web/viewer.js (1607)