Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread TPlugin .. does not want to display PDF on a mobile device (android)
Wed, Sep 6 2017 10:17 PMPermanent Link

R&D team @ Environment Canada

I have a simple web page/app built in EWB that has a TPlugin. I specify the URL, and the mime type ("application/pdf").

The result is fine on a desktop/laptop (in any browser).

However, when I load the same page on my (android) phone.. I get this little puzzle piece that says 'This plug-in is not supported'. Yet I do know that my phone does display PDFs.. all I have to do is go directly to the file listing (using the same mobile browser) and it loads the file properly.

Any ideas? It there a difference between how the TPlugin works vs. a direct link? Or is it a setting on my phone (I've looked, and I've tried on both Chrome and other mobile browsers).

It's not a big deal. But if someone has bumped into this and found a solution..  

thanks.. Bruno
Thu, Sep 7 2017 12:35 AMPermanent Link

Bruno Larochelle

.. and .. I know notice that Tim's 'PDF Client Example' (in the tutorials), which uses a TPlugin, loaded via a server module (with a filestream).. displays just fine on the phone browser ..

(so, for reasons I don't quite understand, I do have a work-around, if needed. but, in my case, the PDFs are already generated, and i have the listing using PHP.. so, ideally, i would rather avoid the server module if possible..)

//



Steven/Phil/Nathan/Bruno @ Environment Canada wrote:

I have a simple web page/app built in EWB that has a TPlugin. I specify the URL, and the mime type ("application/pdf").

The result is fine on a desktop/laptop (in any browser).

However, when I load the same page on my (android) phone.. I get this little puzzle piece that says 'This plug-in is not supported'. Yet I do know that my phone does display PDFs.. all I have to do is go directly to the file listing (using the same mobile browser) and it loads the file properly.

Any ideas? It there a difference between how the TPlugin works vs. a direct link? Or is it a setting on my phone (I've looked, and I've tried on both Chrome and other mobile browsers).

It's not a big deal. But if someone has bumped into this and found a solution..  

thanks.. Bruno
Thu, Sep 7 2017 3:13 AMPermanent Link

Uli Becker

Bruno,
> It's not a big deal. But if someone has bumped into this and found a solution..

I don't use a TPlugin- but a TLink-component to download/display pdf files.
The TLink component is hidden and this code displays the pdf-file:

   with HiddenLink do
   begin
      NewWindow := false;
      HiddenLink.URL := MyPDFURL;
      HiddenLink.DoClick;
   end;

Simple and works fine on mobile devices for me.

Uli
Thu, Sep 7 2017 3:37 AMPermanent Link

Matthew Jones

Uli Becker wrote:

> I don't use a TPlugin

Me neither. I'm fairly sure I use TBrowser with the URL that is a PDF. The browser takes care of it.

--

Matthew Jones
Thu, Sep 7 2017 11:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bruno,

<< .. and .. I know notice that Tim's 'PDF Client Example' (in the tutorials), which uses a TPlugin, loaded via a server module (with a filestream).. displays just fine on the phone browser ..

(so, for reasons I don't quite understand, I do have a work-around, if needed. but, in my case, the PDFs are already generated, and i have the listing using PHP.. so, ideally, i would rather avoid the server module if possible..) >>

There's no need for a module to do this, what you have should be fine.

I would start with this: open the developer tools in the desktop browser (F12) and enable network tracing.  Then, go ahead and monitor the requests and responses when you run the example application.  Then, do the same with your application that is trying to load the PDF (also in the desktop).  Compare the requests/responses to see if there's any differences in the response headers, etc.  That should tell you where the back-end is deviating from what the PDF example module is doing.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Sep 7 2017 12:45 PMPermanent Link

Bruno Larochelle

thanks Uli, Matthew, Tim

I will explore and see what I find

.. Bruno

Tim Young [Elevate Software] wrote:

Bruno,

<< .. and .. I know notice that Tim's 'PDF Client Example' (in the tutorials), which uses a TPlugin, loaded via a server module (with a filestream).. displays just fine on the phone browser ..

(so, for reasons I don't quite understand, I do have a work-around, if needed. but, in my case, the PDFs are already generated, and i have the listing using PHP.. so, ideally, i would rather avoid the server module if possible..) >>

There's no need for a module to do this, what you have should be fine.

I would start with this: open the developer tools in the desktop browser (F12) and enable network tracing.  Then, go ahead and monitor the requests and responses when you run the example application.  Then, do the same with your application that is trying to load the PDF (also in the desktop).  Compare the requests/responses to see if there's any differences in the response headers, etc.  That should tell you where the back-end is deviating from what the PDF example module is doing.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Sep 9 2017 1:59 AMPermanent Link

R&D team @ Environment Canada

hi again

I tried running your web-app example (PDF client) in 'f12' mode, as well as mine. All seems 'OK' (code 200), and I do get the expected behavior on Desktop browsers. The only difference I can tell is that the 'cause' of the network transfer is an 'object' when using your example (PDF client, using a server-side module) and a 'subdocument' when using mine (using a simple URL to the PDF)

I could 'snapshot' it and post it here, but if anyone wants to dig in an see if they can figure it out:

EWB web app (which works fine on either Desktop or mobile):
http://www.elevatesoft.com:8081/pdfclient/pdfclient.html

My simple example (which works find on Desktop browser, but won't load on mobile):
http://mscportal.edm.ab.ec.gc.ca/MBhighwaysWxUpdate/dailywxupdateex.html



Again, this is not 'high priority' by any means, and I can find other ways around it.

.. Bruno

(I tried using the TBrowser instead, and indeed that works, but it's not as 'smooth' as what the TPlugin can do.. my mobile prompts me if I want to 'download' the PDF when I use the TBrowser. It works, just not as seamless as it could be. I guess using a TLink would be similar. I suspect a server-module sending the PDF would work (like the example), but would rather avoid as this is Linux served)


Tim Young [Elevate Software] wrote:

Bruno,

There's no need for a module to do this, what you have should be fine.

I would start with this: open the developer tools in the desktop browser (F12) and enable network tracing.  Then, go ahead and monitor the requests and responses when you run the example application.  Then, do the same with your application that is trying to load the PDF (also in the desktop).  Compare the requests/responses to see if there's any differences in the response headers, etc.  That should tell you where the back-end is deviating from what the PDF example module is doing.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Sep 9 2017 3:39 AMPermanent Link

Uli Becker

Bruno,

> EWB web app (which works fine on either Desktop or mobile):
> http://www.elevatesoft.com:8081/pdfclient/pdfclient.html

What do you mean by "works fine"? Are you saying that the pdf is
displayed on mobile devices?
I don't see that here. When running Tim's app on any mobile device, the
pdf is downloaded, but not displayed.

AFAIK you have either offer a download (on mobile devices) to the user
or use something like this:

https://mozilla.github.io/pdf.js/

No idea if it's possible to embed it in EWB though (not a js expert at all).

Uli

Sat, Sep 9 2017 6:30 AMPermanent Link

R&D team @ Environment Canada

hi Uli

I just tried Tims' tutorial example again on my mobile.. and indeed.. it does ask for a download (I did not remember that).. but it does display it. My example does not however.. it just does nothing when running on mobile (or indicates that the 'plug in' is not available or something like that). So, somehow, having a PDF fed via a module (like Tim) causes a different behavior than a direct URL (like mine), when using TPlugin. At least on my phone ..

I guess what I *want* is probably not possible.. I wanted it to do exactly what it does on a desktop browser.. just load the PDF into the plug-in window.. without prompting the user.

Again, thanks for your help.

.. Bruno

Uli Becker wrote:

Bruno,

> EWB web app (which works fine on either Desktop or mobile):
> http://www.elevatesoft.com:8081/pdfclient/pdfclient.html

What do you mean by "works fine"? Are you saying that the pdf is
displayed on mobile devices?
I don't see that here. When running Tim's app on any mobile device, the
pdf is downloaded, but not displayed.

AFAIK you have either offer a download (on mobile devices) to the user
or use something like this:

https://mozilla.github.io/pdf.js/

No idea if it's possible to embed it in EWB though (not a js expert at all).

Uli
Sat, Sep 9 2017 7:49 AMPermanent Link

R&D team @ Environment Canada

just to wrap this up.. what I finally did was use a TBrowser (as Matthew mentioned I might). That gives me a very elegant solution with Desktop browsers (the user is not prompted.. and the PDF is displayed in the 'frame'), This solution also works fine on a mobile (well, on mine anyway!), although the user does get prompted before it gets displayed, and it is displayed full-screen (not in the frame).

thanks all!
Page 1 of 2Next Page »
Jump to Page:  1 2
Image