New HTMLview Class for Android (Viewing PDFs)

Discuss GUI programming with the RapaGUI plugin here
Post Reply
PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

New HTMLview Class for Android (Viewing PDFs)

Post by PEB »

I know that there's a new (not yet released) HTMLview class for Android that allows for pinch-zooming viewtopic.php?f=27&t=2195&p=15875&hilit=htmlview#p15875.

Is there any way to use this new version of HTMLview to display a page from a PDF document? I've tried embedding a PDF in an HTML file, but have not had success viewing it through the currently available HTMLview class for Android.

(My main goal is to use the new pinch-zooming feature to be able to zoom in on a page of a PDF file with smooth scaling. I know I can convert a PDF page to a PNG brush and then display it in an HTML file, but that won't look so good when zoomed in.)

User avatar
airsoftsoftwair
Posts: 4349
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: New HTMLview Class for Android (Viewing PDFs)

Post by airsoftsoftwair »

I'm afraid that won't work because HTMLview can't view PDF. But you could probably show the PDF using Run()...

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: New HTMLview Class for Android (Viewing PDFs)

Post by PEB »

I'd really like to be able to do this from within my app rather than launching another app.

The HTMLview class seems to be able to display SVG images in a web page just fine. Would it be possible to add the ability (using the SVG and/or Polybios plugins) to save a vector brush (loaded from a PDF page) as an SVG image? That would provide a good workaround, since the SVG image would look smooth even at maximum zoom.

User avatar
airsoftsoftwair
Posts: 4349
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: New HTMLview Class for Android (Viewing PDFs)

Post by airsoftsoftwair »

Converting PDF to SVG isn't easily possible but you might be able to work around the problem by opening the PDF using Google Docs. You can pass PDF any PDF URL to Google Docs and it will work inside the HTMLview class on Android. For example, open the URL https://docs.google.com/gview?embedded= ... lywood.pdf to view the Hollywood PDF inside a HTMLview widget...

plouf
Posts: 131
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: New HTMLview Class for Android (Viewing PDFs)

Post by plouf »

another work around is to use a javascript pdf viewer therefore the entire page will be the "pdf reader"

the following code works in my mobile chrome
Example url
https://mozilla.github.io/pdf.js/web/viewer.html

pdf.js project homepage
https://github.com/mozilla/pdf.js
Christos

PEB
Posts: 535
Joined: Sun Feb 21, 2010 1:28 am

Re: New HTMLview Class for Android (Viewing PDFs)

Post by PEB »

@plouf

Thanks for that information! That javascript pdf viewer is really interesting and seems to be more flexible than what can be done using Google Docs.
It does not, however, work with the currently available HTMLview Class for Android. Perhaps the newer one will work, but we'll have to wait for the new RapaGUI to be released before I can test it.

Ideally, though, a page of a locally stored PDF file could be viewed with the HTMLview Class even when not connected to the internet; but this does not seem to be possible right now.

plouf
Posts: 131
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: New HTMLview Class for Android (Viewing PDFs)

Post by plouf »

hm its true that i have not tested it, and yes not work, but its odd since webview class is reporting chrome 85 here, the same as chrome browser
additional alternative apps who named "webview tester" works as is..

but seems that webview initianlization is diffirtent you can see it from google site its render diffirently !
Christos

plouf
Posts: 131
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: New HTMLview Class for Android (Viewing PDFs)

Post by plouf »

i think javascript is disabled in webview (htmlview) even the simplest javascript seems not work

example code

Code: Select all

<html>
<body>
<script>
alert("hello");
</script>
</body>
</html>
Christos

Post Reply