Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24272] Universal Windows App (UWP) - Ability to display PDF in webview

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionNot Our Bug
Resolution Date2017-02-15T10:32:52.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sn/a
ComponentsWindows
Labelsn/a
ReporterNeeraj Mishra
AssigneeKota Iguchi
Created2017-01-04T07:00:13.000+0000
Updated2018-03-19T04:59:33.000+0000

Description

Problem Description:

When creating a WebView whose url property points to a PDF resource (like http://edis.ifas.ufl.edu/pdffiles/fe/fe57700.pdf or http://bdrconsultants.com/goalsetting.pdf ) the WebView is not even shown in the UI of the app, while, for instance, in iOS it'll display a WebView and the PDF within it.

Steps to Reproduce:

1. Create a Alloy project and use the attached index.xml, index.tss and index.js files. 2. Run the app on Windows Emulator 2. WebView will not load upon launching 3. Tried with Titanium classic app and it does not work there as well. Please find the sample
var webview = Titanium.UI.createWebView({url:'http://edis.ifas.ufl.edu/pdffiles/fe/fe57700.pdf'});
    var window = Titanium.UI.createWindow();
    window.add(webview);
    window.open({modal:true});

Current Behavior:

1. It works on iOS app and shows the pdf inside the WebView and works as expected. 2. On windows app it does not show anything.

Expected Result:

Upon launching, WebView should open the pdf content for windows app similar to iOS. Note: I tried with classic app and sample code is attached above and it does not work with that as well.

Attachments

FileDateSize
index.js2017-01-04T06:58:59.000+0000399
index.tss2017-01-04T06:58:51.000+0000281
index.xml2017-01-04T06:58:43.000+000085

Comments

  1. Ewan Harris 2017-01-04

    [~nmishra] I believe displaying a PDF in a webview is not supported by UWP, see the [WebView class reference](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.webview.aspx) and [MSDN](https://social.msdn.microsoft.com/Forums/windowsapps/en-US/49aff2a4-2250-4537-8490-a57b88df0914/uwphow-to-display-a-url-in-webview-which-contains-a-pdf-file?forum=wpdevelop). To display PDFs [Windows.Data.Pdf](https://msdn.microsoft.com/en-us/library/windows/apps/windows.data.pdf.aspx). So this should probably be a feature request for an equivalent _Windows only_ API in Titanium.
  2. Kota Iguchi 2017-01-09

    So basically UWP WebView doesn't support opening PDF. Microsoft indicates to use [Windows.Data.Pdf](https://msdn.microsoft.com/en-us/library/windows/apps/windows.data.pdf.aspx), but yes currently [Titanium Direct PI Access](https://docs.appcelerator.com/platform/latest/?mobile=/guide/Windows_Runtime_Direct_API_Access) is broken now and I don't expect fully functional native programming in Hyperloop for Windows will be available on 6.1.0 release. I saw a interesting workaround for this: [Use Google Docs Viewer to open pdf](http://stackoverflow.com/questions/37678638/how-to-display-a-url-in-webview-which-contains-a-pdf-fileuwp-xaml). That way you don't have to depend on/implement anything but just navigate to the url. This may mean you need to log-on to the Google Docs though.
  3. Kota Iguchi 2017-01-26

    I took a quick look at this but I was not able to find a good way to view local pdf file with Google Docs. I expect we could do this by developing new Titanium module with use of [Windows.Data.Pdf](https://msdn.microsoft.com/en-us/library/windows/apps/windows.data.pdf.aspx) API.
  4. Kota Iguchi 2017-02-06

    I am able to view PDF document on my Windows 10 Mobile device when I use Microsoft's [File Explorer](https://www.youtube.com/watch?v=nukqWSDJPRw). So we could save pdf documents by Ti app to somewhere locally on the device, and we then could ask user to open it via File Explorer app.
  5. Kota Iguchi 2017-02-15

    So I would resolve this ticket as "Not Our Bug" for now, because Windows WebView does not support it. We have a workaround for it, by using Google Docs Viewer when it is on the public (http web). We are also pushing another workaround in TIMOB-23319, which enables you to open local pdf file by Ti.Platform.openURL.
  6. Neeraj Mishra 2017-02-15

    Thanks [~kota].
  7. Lee Morris 2017-03-24

    Closing ticket with reference to the previous comments.

JSON Source