How to enable pinch zoom on a web view loading a url with pdf(Android)? -


pinch zoom works fine on webview loads regular url, if enable settings below,

mywebview.getsettings().setbuiltinzoomcontrols(true); //this works fine. 

the issue is,

i have webview loads url pdf. using google docs viewer load url avoid downloading pdf device. like,

'"http://docs.google.com/gview?embedded=true&url=http://www.abc.com/xxxxxyyyyyxz.pdf"'

loading url on web view shows pdf built in zoom option as, button click or double tap zoom in , button click zoom out.

this not great user experience compared pinch zoom.

so far, have tried many solutions, nothing worked yet. have tried following,

  1. android-pinch open source library, works maps , web view loads url image.
  2. this tutorial helpful couldn't working webview.

if has anyother useful information me tryout, please share.

pdfs notoriously difficult interact in android. could:

1.) roll own implementation of webview supports pdf

i don't recommend doing way. typical logic if google hasn't done sufficiently long period of time, it's either difficult do, or not battery efficient. in case, may have hands dirty android ndk in order make implementation fast , efficient.

http://gurushya.com/customizing-android-webview/

2.) convert pdf series of bitmaps

for option, need parse content of webpage find necessary pdf, convert each slide of pdf bitmap, , display each bitmap in simple imageslider. haven't had time try method, seems may work (probably not though). stackoverflow answer may help:

need convert pdf page bitmap in android java

3.) follow convention - recommended

this best option. using google docs of hack. when pass pdf, you're opening javascript pdf reader lousy mobile support. typical way of handling pdf's in android checking if user has pdf reader installed , opening pdf if do. pdf reader more have pinch zoom functionality. android implemented way performance reasons , work across broader scope of devices.

keep in mind while average ios user may not used this; android users quite comfortable opening files in other apps. opening pdf in pdf reader gives user ability choose pdf reader use. doing so, give reader more options pinch zoom (such indexed search, highlighting, quick navigation ui) depending on app have installed. if don't have pdf reader? suggest free 1 , link them android store of choice!

render pdf file using java on android


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -