Page 1 of 1
New HTMLview Class for Android (Viewing PDFs)
Posted: Thu Sep 10, 2020 12:23 am
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.)
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Thu Sep 10, 2020 7:29 pm
by airsoftsoftwair
I'm afraid that won't work because HTMLview can't view PDF. But you could probably show the PDF using
Run()...
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Fri Sep 11, 2020 7:08 am
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.
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Fri Sep 18, 2020 11:51 pm
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...
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Sun Sep 20, 2020 12:55 pm
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
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Tue Sep 22, 2020 11:54 pm
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.
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Thu Sep 24, 2020 9:13 am
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 !
Re: New HTMLview Class for Android (Viewing PDFs)
Posted: Fri Sep 25, 2020 10:26 am
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>