I need a little help loading and displaying pictures and documents. It APPEARS the best way to do this is a Webview control because I want the users to be able to use gestures to zoom/resize. But I am not married to a Webview if there is a better way. I know virtually nothing about HTML and don't really want to learn any more about it than I have to to do the job.
I found the following snippet of code,
which I modified and works - loads the pictures OK.
BUT, not to scale. I know in some Windows controls there is a setting that will simply load a picture, to scale, as large as possible in a given control and leave whitespace on the top/bottom or sides if the controls scale does not match the bitmap scale. That would be ideal.
Barring that, I have already written code to load a bitmap and use the height and width property to properly size an Imageview. I could do that as well, but I need to know what part of that HTML code to change to do this .
Also, with the code above there is a 'quirk' when using gestures to resize. When I use two fingers to enlarge the image it works fine until I take my fingers off the screen, then it snaps back to size, and places the upper left corner of the image more or less randomly, sometimes completely off the screen. I need to be able to zoom in on portions of the picture (many of these images are technical drawings).
I will also need to do something similar with .pdf files, and, hopefully Word Docs and Excel files maybe even .dxf (cad drawings) I understand those will be handled by external apps but if anyone has any ideas/experience along those lines (which programs to use how, to load my files to them from my program, etc.) it would be greatly appreciated.
A little background: We have a lot of customers who use our manufacturing management software. They have spent thousands of hours writing mfg. instructions. Usually in Adobe, Word, and Excel plus a lot of pictures. The are not going to rewrite these and we want to start displaying them on tablets.
Thanks in advance for your support and thanks to everyone out there for your incredible support so far. This is truly an amazing community!
I found the following snippet of code,
B4X:
WebView1.LoadHtml("<html><head><style Type=""text/css""> img { position: absolute; width: 300px; height: 300px; left: 50%; top: 50%; margin-left: -150px; margin-top: -150px; }</style> </head> <body> <img src=""File:///android_asset/picture.png""> </body> </html>")
which I modified and works - loads the pictures OK.
B4X:
WebView1.LoadHtml("<html><head><style Type=""text/css""> img { position: absolute; width: 100%; height: 100%; left: 0%; top: 0%; margin-left: -150px; margin-top: -150px; }</style> </head> <body> <img src=""" & Main.PartPicFile & """> </body> </html>")
BUT, not to scale. I know in some Windows controls there is a setting that will simply load a picture, to scale, as large as possible in a given control and leave whitespace on the top/bottom or sides if the controls scale does not match the bitmap scale. That would be ideal.
Barring that, I have already written code to load a bitmap and use the height and width property to properly size an Imageview. I could do that as well, but I need to know what part of that HTML code to change to do this .
Also, with the code above there is a 'quirk' when using gestures to resize. When I use two fingers to enlarge the image it works fine until I take my fingers off the screen, then it snaps back to size, and places the upper left corner of the image more or less randomly, sometimes completely off the screen. I need to be able to zoom in on portions of the picture (many of these images are technical drawings).
I will also need to do something similar with .pdf files, and, hopefully Word Docs and Excel files maybe even .dxf (cad drawings) I understand those will be handled by external apps but if anyone has any ideas/experience along those lines (which programs to use how, to load my files to them from my program, etc.) it would be greatly appreciated.
A little background: We have a lot of customers who use our manufacturing management software. They have spent thousands of hours writing mfg. instructions. Usually in Adobe, Word, and Excel plus a lot of pictures. The are not going to rewrite these and we want to start displaying them on tablets.
Thanks in advance for your support and thanks to everyone out there for your incredible support so far. This is truly an amazing community!
Last edited: