简体   繁体   中英

TwebBrowser Zoom/Gesture is not working for firemonkey/iOs in XE4 when open a pdf file

I want to display PDF within iOS application, so far the only way I find is open it in TwebBrowser.

A.It is displaying in "fit to page width" zoom as default

B.There is no "zoom" function

WebBrowser1.Navigate(file://mypdf.pdf')

How to

  1. I want to change the zoom after open the file (My solution encounter q#2)
  2. Make the zoom work (My solution encounter q#3)
  3. Make the gesture as work just like web page

For #1:

I chagne WebBrowser1.height/width in run-time, it will auto scale(zoom?) as "Fit to width".

Yes it works, and vertical scroll bar works with a flaw - it will not bounce back on edge -> you can scroll all the way down..

Neither the horizontal scroll, not reacting at all....

*This is because the pdf is A4, not sure what will happen for a landscape style

For #2:

Beside using button clicks to zoom, I add a gestureManager.

Then add Form1.ongesture just like the "iOS Interactive Gestures - Image Zoom" example.

Yes it works, but same thing - no vertical bounce, no horizontal scroll.

*ScrollBox does not work, it will not work with any thing has a build-in vert/hori scroll bars

For #3 : I go even further, write control for up/down/left/right

Change WebBrowser1.Position.X/Y and WebBrowser1.height/width to make it looks like "scrolling"

Yes it works... but two custom gesture controls are making it really hard to control

(EventInfo.Distance and EventInfo.X/Y, those 2 controls are kinda overlaping to eachother if you run in iPhone)

The wosrt part is, the WebBrowser1 will be on top of ANY compenment, regardless parent/child structure . The second worst part is the limitation of margin is hard to code, somehow it can always scroll over the limit.....

I "feel" if changing the zoom on/after open, and make it open with both vert/hori scrool bars visible. Then the horizontal bar should work -> i only need to deal with zoom -> pretty close to prefect.

Of course the best way is to make it work like a web page, like WebBrowser1.Navigate(' http://www.embarcadero.com/ ') -> both scrollbars works, zoom work. but...maybe need service pack N for this?

I appreciate for any ideas or code answers.

This damned monkey is on fire and its always hard to find an answer from it.

An article was posted today on The Hacker's Corner called Getting TWebBrowser on iOS to zoom . It suggests a one-line fix to the FMX.WebBrowser.iOS.pas unit. Does this help?

这是一个错误,并在XE4更新中得到修复。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM