简体   繁体   English

打开pdf文件时,TwebBrowser Zoom / Gesture不适用于XE4中的firemonkey / iOs

[英]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. 我想在iOS应用程序中显示PDF,到目前为止我找到的唯一方法是在TwebBrowser中打开它。

A.It is displaying in "fit to page width" zoom as default A.默认情况下,它以“适合页面宽度”缩放显示

B.There is no "zoom" function B.没有“缩放”功能

WebBrowser1.Navigate(file://mypdf.pdf') WebBrowser1.Navigate时(文件://mypdf.pdf“)

How to 如何

  1. I want to change the zoom after open the file (My solution encounter q#2) 我想在打开文件后更改缩放(我的解决方案遇到q#2)
  2. Make the zoom work (My solution encounter q#3) 使缩放工作(我的解决方案遇到q#3)
  3. Make the gesture as work just like web page 使手势像网页一样工作

For #1: 对于#1:

I chagne WebBrowser1.height/width in run-time, it will auto scale(zoom?) as "Fit to width". 我在运行时chagne WebBrowser1.height / 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 *这是因为pdf是A4,不确定横向风格会发生什么

For #2: 对于#2:

Beside using button clicks to zoom, I add a gestureManager. 除了使用按钮点击进行缩放之外,我还添加了一个gestureManager。

Then add Form1.ongesture just like the "iOS Interactive Gestures - Image Zoom" example. 然后像“iOS交互式手势 - 图像缩放”示例一样添加Form1.ongesture。

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 * ScrollBox不起作用,它不会与任何东西有内置的vert / hori滚动条

For #3 : I go even further, write control for up/down/left/right 对于#3:我走得更远,写上/下/左/右控制

Change WebBrowser1.Position.X/Y and WebBrowser1.height/width to make it looks like "scrolling" 更改WebBrowser1.Position.X / Y和WebBrowser1.height / width使其看起来像“滚动”

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) (EventInfo.Distance和EventInfo.X / Y,如果你在iPhone上运行,这两个控件有点重叠)

The wosrt part is, the WebBrowser1 will be on top of ANY compenment, regardless parent/child structure . wosrt部分是,无论父/子结构如何,WebBrowser1都将位于任何补偿之上。 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. 如果在打开后打开变焦,我会“感觉”,并且可以看到两个vert / hori scrool条都打开。 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. 当然最好的方法是让它像网页一样工作,比如WebBrowser1.Navigate(' http://www.embarcadero.com/ ') - >两个滚动条都适用,缩放工作。 but...maybe need service pack N for this? 但是......也许需要服务包N呢?

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 . 今天发布了一篇名为The Hacker's Corner的文章,称为iOS上的Getting TWebBrowser It suggests a one-line fix to the FMX.WebBrowser.iOS.pas unit. 它建议对FMX.WebBrowser.iOS.pas单元进行单行修复。 Does this help? 这有帮助吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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